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

Detailed Description

DtQtQuickOverlay loads and manages QML files as overlays for the 3D scene. It can bind state attributes to QML properties, control overlay visibility based on player state, and optionally hide the 3D scene when only the overlay should be visible.

#include <qtQuickOverlay.h>

Inheritance diagram for makVre::DtQtQuickOverlay:
[legend]

Classes

struct  Connection
 

Public Member Functions

 DtQtQuickOverlay ()
 
virtual ~DtQtQuickOverlay () override
 
virtual bool initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
 
virtual bool postInitialize () override
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual const char * type () const override
 
virtual void setRoot (QQuickItem *root)
 
virtual void initdoc (QQuickItem *root)
 
virtual DtVreMessageResult handleEnterPlayerState (DtVreMessage *msg)
 
virtual DtVreMessageResult handleExitPlayerState (DtVreMessage *msg)
 
virtual void setVisibility (bool visible)
 
virtual bool isVisible ()
 
virtual void setMenuState (bool on)
 
- Public Member Functions inherited from makVre::DtPlayerComponent
 DtPlayerComponent ()
 
virtual ~DtPlayerComponent ()
 
virtual void setName (const std::string &name)
 
virtual const std::string & name ()
 
virtual DtPlayerStationplayer ()
 
virtual DtAttributeHandleplayerAttributeStore ()
 
virtual const DtAttributeHandleplayerAttributeStore () const
 

Protected Member Functions

virtual void updateVals (double dt)
 
virtual void disconnect ()
 
virtual bool buildConnections (DtInitTable &connections)
 
virtual void onVisibilityAttributeChanged (bool on)
 
virtual void removeModelSetAndSkyFromChannel ()
 
virtual void restoreModelSetAndSkyToChannel ()
 
- Protected Member Functions inherited from makVre::DtPlayerComponent
virtual void initializeStateAttributes ()
 

Protected Attributes

DtInitTable myBindQmlPropertyToAttribute
 
QQuickItem * myRoot
 
std::string myTargetWindow
 
std::vector< ConnectionmyConnections
 
std::string myQmlFile
 
std::string myQmlDataItemName
 
bool myIsInMenuState
 
bool myCachedVisibility
 
DtAttributeHandleType< bool > myVisibilityAttribute
 
bool myRenderOverlayOnly
 
bool myWantSceneHidden
 
makVrv::DtOsgChannel * myChannel
 
makVrv::DtObserverObject * myObserver
 
QObject myQObject
 
bool myHasTickFunction
 
- Protected Attributes inherited from makVre::DtPlayerComponent
std::string myName
 
DtInitTable myConfig
 
DtPlayerStationmyPlayer
 
makVrv::DtDe * myDe
 
DtEntityResolvermyResolver
 
DtAttributeCallbackManager myAttributeCallbacks
 

Constructor & Destructor Documentation

◆ DtQtQuickOverlay()

makVre::DtQtQuickOverlay::DtQtQuickOverlay ( )

Constructor for DtQtQuickOverlay.

◆ ~DtQtQuickOverlay()

virtual makVre::DtQtQuickOverlay::~DtQtQuickOverlay ( )
overridevirtual

Alternative constructor with target window parameter (commented out)

Parameters
target_windowThe target window to display the overlay on

Destructor that cleans up message handlers and attribute callbacks

Member Function Documentation

◆ initialize()

virtual bool makVre::DtQtQuickOverlay::initialize ( makVre::DtPlayerStation * player,
makVre::DtInitTable & config )
overridevirtual

Initializes the overlay component with configuration options.

Parameters
playerPointer to the player station this component belongs to
configConfiguration table containing overlay settings
Returns
True if initialization succeeded, false otherwise

Required configuration parameters:

  • qmlFilename: Path to the QML file to load
  • qmlDataItemObjectName: Name of the QML object to bind data to
  • qmlDataItemBindings: Table of bindings from state attributes to QML properties

Optional configuration parameters:

  • qmlTargetWindow: Window to display the overlay on
  • visibilityAttribute: Attribute name to control visibility
  • renderOverlayOnly: If true, hides the 3D scene when the overlay is visible

Reimplemented from makVre::DtPlayerComponent.

Reimplemented in makVre::DtBinocularsLasingOverlay, makVre::DtBinocularsOverlay, makVre::DtBinocularsZoomOverlay, and makVre::DtSpectatorOverlay.

References makVre::DtPlayerComponent::player().

◆ postInitialize()

virtual bool makVre::DtQtQuickOverlay::postInitialize ( )
overridevirtual

Performs post-initialization steps after all components are initialized.

Returns
True if post-initialization succeeded, false otherwise

Builds connections between state attributes and QML properties, then loads the QML file using the appropriate renderer method based on VR status

Reimplemented from makVre::DtPlayerComponent.

Reimplemented in makVre::DtBinocularsLasingOverlay, makVre::DtBinocularsOverlay, and makVre::DtBinocularsZoomOverlay.

◆ tick()

virtual void makVre::DtQtQuickOverlay::tick ( double dt)
overridevirtual

Called every frame to update the overlay.

Parameters
dtDelta time since the last frame in seconds

Updates QML property values from state attributes and handles scene visibility

Implements makVre::DtPlayerComponent.

Reimplemented in makVre::DtBinocularsLasingOverlay, makVre::DtBinocularsOverlay, makVre::DtBinocularsZoomOverlay, and makVre::DtSpectatorOverlay.

◆ shutdown()

virtual void makVre::DtQtQuickOverlay::shutdown ( )
overridevirtual

Shuts down the overlay component.

Closes the UI, restores 3D scene visibility if needed, and disconnects property bindings

Reimplemented from makVre::DtPlayerComponent.

Reimplemented in makVre::DtBinocularsLasingOverlay, makVre::DtBinocularsOverlay, and makVre::DtSpectatorOverlay.

◆ type()

virtual const char * makVre::DtQtQuickOverlay::type ( ) const
overridevirtual

Returns the type identifier for this component.

Returns
The type string for DtQtQuickOverlay

Implements makVre::DtPlayerComponent.

Reimplemented in makVre::DtBinocularsLasingOverlay, makVre::DtBinocularsOverlay, makVre::DtBinocularsZoomOverlay, and makVre::DtSpectatorOverlay.

◆ setRoot()

virtual void makVre::DtQtQuickOverlay::setRoot ( QQuickItem * root)
inlinevirtual

Sets the root QQuickItem for this overlay.

Parameters
rootPointer to the root QQuickItem

References myRoot.

◆ initdoc()

virtual void makVre::DtQtQuickOverlay::initdoc ( QQuickItem * root)
virtual

Initialize document with the root QQuickItem.

Parameters
rootPointer to the root QQuickItem

Stores the root item and sets initial visibility based on the visibility attribute

Reimplemented in makVre::DtSpectatorOverlay.

◆ handleEnterPlayerState()

virtual DtVreMessageResult makVre::DtQtQuickOverlay::handleEnterPlayerState ( DtVreMessage * msg)
virtual

Handles messages for entering player states.

Parameters
msgThe message containing the state transition information
Returns
Message handling result indicating if the message was handled

Special handling for MENU_STATE and ENGAGED states to control overlay visibility and scene visibility when renderOverlayOnly is true

◆ handleExitPlayerState()

virtual DtVreMessageResult makVre::DtQtQuickOverlay::handleExitPlayerState ( DtVreMessage * msg)
virtual

Handles messages for exiting player states.

Parameters
msgThe message containing the state transition information
Returns
Message handling result indicating if the message was handled

Special handling for MENU_STATE to restore previous overlay visibility and control scene visibility when renderOverlayOnly is true

◆ setVisibility()

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

Sets the visibility of the overlay.

Parameters
visibleTrue to show the overlay, false to hide it

Sets the "visible" property on the root QML item

◆ isVisible()

virtual bool makVre::DtQtQuickOverlay::isVisible ( )
virtual

Checks if the overlay is currently visible.

Returns
True if the overlay is visible, false otherwise

Reads the "visible" property from the root QML item

◆ setMenuState()

virtual void makVre::DtQtQuickOverlay::setMenuState ( bool on)
virtual

Updates the menu state and toggles visibility accordingly.

Parameters
onTrue if entering menu state, false if exiting

When entering menu state, caches and hides the overlay When exiting menu state, restores the previous visibility

◆ updateVals()

virtual void makVre::DtQtQuickOverlay::updateVals ( double dt)
protectedvirtual

Updates QML property values from state attributes.

Parameters
dtDelta time since the last frame in seconds

Finds the QML value source object and updates properties based on current state attribute values, then calls the tick method on the source

◆ disconnect()

virtual void makVre::DtQtQuickOverlay::disconnect ( )
protectedvirtual

Disconnects all property bindings.

Clears the connections list to remove all bindings

◆ buildConnections()

virtual bool makVre::DtQtQuickOverlay::buildConnections ( DtInitTable & connections)
protectedvirtual

Builds connections between state attributes and QML properties.

Parameters
connectionsConfiguration table defining the connections
Returns
True if connections were successfully built, false otherwise

Each connection maps a state attribute to a QML property

◆ onVisibilityAttributeChanged()

virtual void makVre::DtQtQuickOverlay::onVisibilityAttributeChanged ( bool on)
protectedvirtual

Called when the visibility attribute changes.

Parameters
onNew visibility value

Sets the overlay visibility based on the new attribute value

◆ removeModelSetAndSkyFromChannel()

virtual void makVre::DtQtQuickOverlay::removeModelSetAndSkyFromChannel ( )
protectedvirtual

Removes the model set and sky from the channel.

Used when renderOverlayOnly is true to hide the 3D scene and only show the overlay

◆ restoreModelSetAndSkyToChannel()

virtual void makVre::DtQtQuickOverlay::restoreModelSetAndSkyToChannel ( )
protectedvirtual

Restores the model set and sky to the channel.

Used to restore the 3D scene visibility after it was hidden

Member Data Documentation

◆ myBindQmlPropertyToAttribute

DtInitTable makVre::DtQtQuickOverlay::myBindQmlPropertyToAttribute
protected

Configuration table containing QML data item bindings.

◆ myRoot

QQuickItem* makVre::DtQtQuickOverlay::myRoot
protected

Pointer to the root QQuickItem for this overlay.

Referenced by setRoot().

◆ myTargetWindow

std::string makVre::DtQtQuickOverlay::myTargetWindow
protected

Name of the target window to display the overlay on.

◆ myConnections

std::vector<Connection> makVre::DtQtQuickOverlay::myConnections
protected

List of connections between state attributes and QML properties.

◆ myQmlFile

std::string makVre::DtQtQuickOverlay::myQmlFile
protected

Path to the QML file to load.

◆ myQmlDataItemName

std::string makVre::DtQtQuickOverlay::myQmlDataItemName
protected

Name of the QML object to bind data to.

◆ myIsInMenuState

bool makVre::DtQtQuickOverlay::myIsInMenuState
protected

Flag indicating if the PlayerStation is in the "MENU_STATE" Used to determine whether the overlays should be visible.

◆ myCachedVisibility

bool makVre::DtQtQuickOverlay::myCachedVisibility
protected

Cached visibility value to restore when exiting menu state.

◆ myVisibilityAttribute

DtAttributeHandleType<bool> makVre::DtQtQuickOverlay::myVisibilityAttribute
protected

Handle to attribute that controls overlay visibility.

◆ myRenderOverlayOnly

bool makVre::DtQtQuickOverlay::myRenderOverlayOnly
protected

Flag indicating if only the overlay should be rendered without the 3D scene.

◆ myWantSceneHidden

bool makVre::DtQtQuickOverlay::myWantSceneHidden
protected

Flag indicating if the 3D scene should be hidden.

◆ myChannel

makVrv::DtOsgChannel* makVre::DtQtQuickOverlay::myChannel
protected

Pointer to the OSG channel used for rendering.

◆ myObserver

makVrv::DtObserverObject* makVre::DtQtQuickOverlay::myObserver
protected

Pointer to the observer object for the channel.

◆ myQObject

QObject makVre::DtQtQuickOverlay::myQObject
protected

QObject used as the owner for the QML UI.

◆ myHasTickFunction

bool makVre::DtQtQuickOverlay::myHasTickFunction
protected

Flag indicating whether the QML data item has a tick(double) function.


The documentation for this class was generated from the following file: