From 9da64e540dd7485b8fdcdd64e2f5a27e040030e2 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 12 Mar 2016 12:53:16 +1300 Subject: [PATCH] Add shortcut keys to HMD menu --- interface/resources/qml/menus/VrMenuItem.qml | 14 ++++++++++++-- libraries/ui/src/VrMenu.cpp | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/menus/VrMenuItem.qml b/interface/resources/qml/menus/VrMenuItem.qml index 5854a75ef5..0b18811ccf 100644 --- a/interface/resources/qml/menus/VrMenuItem.qml +++ b/interface/resources/qml/menus/VrMenuItem.qml @@ -81,15 +81,25 @@ Item { } Item { - // Space for shortcut key or disclosure icon. id: tail - width: 48 + width: 48 + (shortcut.visible ? shortcut.width : 0) anchors { verticalCenter: parent.verticalCenter right: parent.right rightMargin: hifi.dimensions.menuPadding.x } + RalewayLight { + id: shortcut + text: source.shortcut ? source.shortcut : "" + size: hifi.fontSizes.shortcutText + color: hifi.colors.baseGrayShadow + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 15 + visible: source.visible && text != "" + } + HiFiGlyphs { text: hifi.glyphs.disclosureExpand color: source.enabled ? hifi.colors.baseGrayShadow : hifi.colors.baseGrayShadow25 diff --git a/libraries/ui/src/VrMenu.cpp b/libraries/ui/src/VrMenu.cpp index 41768a5349..5acf81c319 100644 --- a/libraries/ui/src/VrMenu.cpp +++ b/libraries/ui/src/VrMenu.cpp @@ -104,6 +104,7 @@ void updateQmlItemFromAction(QObject* target, QAction* source) { target->setProperty("checkable", source->isCheckable()); target->setProperty("enabled", source->isEnabled()); target->setProperty("text", source->text()); + target->setProperty("shortcut", source->shortcut().toString()); target->setProperty("checked", source->isChecked()); target->setProperty("visible", source->isVisible()); }