|
VR-Engage
2.2
|
DtQmlActionMenu provides the bridge between the C++ menu system and the QML-based UI rendering. It exposes menu data to QML, processes user interactions, and coordinates with the underlying DtMenu objects. This class allows the menu system to use modern QML rendering while maintaining the C++ business logic.
#include <qmlActionMenu.h>
Public Member Functions | |
| virtual Q_INVOKABLE void | button_clicked (int index) |
| virtual Q_INVOKABLE void | selectItem (int index) |
| DtQmlActionMenu () | |
| virtual | ~DtQmlActionMenu () override |
| void | updateMenuData () |
| void | initDoc (QQuickItem *rootItem) |
| void | setVisible (bool visible) |
| void | setSelectedMenuIndex (int index) |
| void | setTitle (const QString &title) |
| void | setMaxMenuLength (const int len) |
Public Attributes | |
| QStringList | myMenus |
| QStringList | myDecorators |
| QQuickItem * | myRoot |
| QObject * | myWindow |
| QObject * | myMenuObject |
| DtMenu * | myCurrentMenu |
| bool | initVisible |
| makVre::DtQmlActionMenu::DtQmlActionMenu | ( | ) |
Constructor.
Creates a new QML action menu interface with default state.
|
overridevirtual |
Virtual destructor.
Ensures proper cleanup of QML resources and connections.
|
virtual |
QML-invokable method for handling button clicks.
| index | Index of the clicked menu item |
Called from QML when a menu button is clicked. This method processes the selection and triggers the appropriate action.
|
virtual |
QML-invokable method for selecting menu items.
| index | Index of the selected menu item |
Called from QML when a menu item is selected but not yet activated. This updates the selection state without triggering the action.
| void makVre::DtQmlActionMenu::updateMenuData | ( | ) |
Updates the menu data exposed to QML.
Refreshes the menu item data based on the current C++ menu state, preparing it for display by the QML UI components.
| void makVre::DtQmlActionMenu::initDoc | ( | QQuickItem * | rootItem | ) |
Initializes the QML document.
| rootItem | Root QML item to attach the menu to |
Sets up the QML document and establishes connections between C++ and QML components. This must be called before the menu can be displayed.
| void makVre::DtQmlActionMenu::setVisible | ( | bool | visible | ) |
Sets the visibility of the menu.
| visible | True to show the menu, false to hide it |
Controls whether the menu is visible in the UI.
| void makVre::DtQmlActionMenu::setSelectedMenuIndex | ( | int | index | ) |
Sets the currently selected menu item.
| index | Index of the menu item to select |
Updates the selection state in the menu without triggering the action.
| void makVre::DtQmlActionMenu::setTitle | ( | const QString & | title | ) |
Sets the menu title.
| title | New title text for the menu |
Updates the title displayed at the top of the menu.
| void makVre::DtQmlActionMenu::setMaxMenuLength | ( | const int | len | ) |
Sets the maximum number of visible menu items.
| len | Maximum number of items to display |
Controls the maximum number of menu items that can be displayed at once. If there are more items than this limit, scrolling will be enabled.
| QStringList makVre::DtQmlActionMenu::myMenus |
List of menu item text strings.
Contains the text of each menu item to be displayed in the QML UI.
| QStringList makVre::DtQmlActionMenu::myDecorators |
List of menu item decorators.
Contains decorator strings (like icons or badges) for menu items.
| QQuickItem* makVre::DtQmlActionMenu::myRoot |
Root QML item for the menu.
The top-level QML item that contains the entire menu UI.
| QObject* makVre::DtQmlActionMenu::myWindow |
Window object for the menu.
QML window object that contains the menu interface.
| QObject* makVre::DtQmlActionMenu::myMenuObject |
QML menu object.
The specific QML object representing the menu within the window.
| DtMenu* makVre::DtQmlActionMenu::myCurrentMenu |
Current C++ menu being displayed.
Pointer to the current DtMenu instance being presented in the QML UI.
| bool makVre::DtQmlActionMenu::initVisible |
Initial visibility flag.
Controls whether the menu is visible when first initialized.