VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtExampleChatWindow Class Reference

Detailed Description

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>

Inheritance diagram for makVre::DtExampleChatWindow:
[legend]

Public Member Functions

 DtExampleChatWindow ()
 
virtual ~DtExampleChatWindow () override
 
virtual void setVisibility (bool visible)
 
virtual bool isVisible ()
 
virtual void close ()
 
virtual void open ()
 
virtual void initMain ()
 
virtual Q_INVOKABLE void clearChat ()
 
virtual void addNewMessage (const DtChatEntry &entry)
 
virtual void addNewMessage (const QString &sender, const QString &receiver, const double time, const QString &message)
 

Protected Attributes

QQuickItem * myRoot
 
DtChatQmlModel myChatModel
 
std::string myTargetWindow
 
std::string myTargetFile
 

Constructor & Destructor Documentation

◆ DtExampleChatWindow()

makVre::DtExampleChatWindow::DtExampleChatWindow ( )

Constructor that loads and initializes the QML chat window.

◆ ~DtExampleChatWindow()

virtual makVre::DtExampleChatWindow::~DtExampleChatWindow ( )
overridevirtual

Destructor for cleanup.

Member Function Documentation

◆ setVisibility()

virtual void makVre::DtExampleChatWindow::setVisibility ( bool visible)
virtual

Sets the visibility of the chat window.

Parameters
visibletrue 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
entryThe 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
senderEntity name of message sender
receiverEntity name of message receiver
timeSimulation time of message
messageText content of message

Member Data Documentation

◆ myRoot

QQuickItem* makVre::DtExampleChatWindow::myRoot
protected

Root QML item loaded from QML file.

◆ myChatModel

DtChatQmlModel makVre::DtExampleChatWindow::myChatModel
protected

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: