This class demonstrates the REUSABLE pattern for integrating Qt Quick (QML) windows into VR-Engage. Key aspects:
- Loading QML files using DtQtQuickRenderer
- Exposing C++ objects to QML via context properties
- Managing window visibility and lifecycle
- Using Q_INVOKABLE for QML-callable methods
This pattern applies to any custom Qt Quick UI that needs to be integrated with VR-Engage player stations.
#include <exampleQtQuick.h>
◆ DtExampleChatWindow()
| makVre::DtExampleChatWindow::DtExampleChatWindow |
( |
| ) |
|
Constructor that loads and initializes the QML chat window.
◆ ~DtExampleChatWindow()
| virtual makVre::DtExampleChatWindow::~DtExampleChatWindow |
( |
| ) |
|
|
overridevirtual |
◆ setVisibility()
| virtual void makVre::DtExampleChatWindow::setVisibility |
( |
bool | visible | ) |
|
|
virtual |
Sets the visibility of the chat window.
- Parameters
-
| visible | true to show the window, false to hide it |
◆ isVisible()
| virtual bool makVre::DtExampleChatWindow::isVisible |
( |
| ) |
|
|
virtual |
Checks if the chat window is currently visible.
- Returns
- true if visible, false if hidden
◆ close()
| virtual void makVre::DtExampleChatWindow::close |
( |
| ) |
|
|
virtual |
Closes the chat window (hides it).
◆ open()
| virtual void makVre::DtExampleChatWindow::open |
( |
| ) |
|
|
virtual |
Opens the chat window (shows it).
◆ initMain()
| virtual void makVre::DtExampleChatWindow::initMain |
( |
| ) |
|
|
virtual |
Initializes the QML root item after loading.
Called by the QML loader callback once the QML file is loaded.
◆ clearChat()
| virtual Q_INVOKABLE void makVre::DtExampleChatWindow::clearChat |
( |
| ) |
|
|
virtual |
Clears all messages from the chat window.
Q_INVOKABLE makes this method callable from QML, allowing the UI to trigger C++ functionality (e.g., a "Clear" button in QML).
◆ addNewMessage() [1/2]
| virtual void makVre::DtExampleChatWindow::addNewMessage |
( |
const DtChatEntry & | entry | ) |
|
|
virtual |
Adds a new message to the chat window.
- Parameters
-
| entry | The chat entry to add |
◆ addNewMessage() [2/2]
| virtual void makVre::DtExampleChatWindow::addNewMessage |
( |
const QString & | sender, |
|
|
const QString & | receiver, |
|
|
const double | time, |
|
|
const QString & | message ) |
|
virtual |
Adds a new message to the chat window.
Convenience overload that constructs a DtChatEntry from individual fields.
- Parameters
-
| sender | Entity name of message sender |
| receiver | Entity name of message receiver |
| time | Simulation time of message |
| message | Text content of message |
◆ myRoot
| QQuickItem* makVre::DtExampleChatWindow::myRoot |
|
protected |
Root QML item loaded from QML file.
◆ myChatModel
Qt model exposed to QML for data binding.
◆ myTargetWindow
| std::string makVre::DtExampleChatWindow::myTargetWindow |
|
protected |
Target window name (empty for standalone)
◆ myTargetFile
| std::string makVre::DtExampleChatWindow::myTargetFile |
|
protected |
QML file path relative to VR-Engage data directory.
The documentation for this class was generated from the following file: