mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 23:26:25 +02:00
Add separators to HMD menus
This commit is contained in:
parent
e175c19754
commit
ecf67282d5
5 changed files with 42 additions and 2 deletions
|
@ -28,7 +28,7 @@ Item {
|
|||
|
||||
CheckBox {
|
||||
id: check
|
||||
// FIXME: Shouild use radio buttons if source.exclusiveGroup.
|
||||
// FIXME: Should use radio buttons if source.exclusiveGroup.
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: hifi.dimensions.menuPadding.x
|
||||
|
@ -60,6 +60,26 @@ Item {
|
|||
visible: source.visible
|
||||
}
|
||||
|
||||
Item {
|
||||
id: separator
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: hifi.dimensions.menuPadding.x + check.width
|
||||
rightMargin: hifi.dimensions.menuPadding.x + tail.width
|
||||
}
|
||||
visible: source.type === MenuItemType.Separator
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
height: 1
|
||||
color: hifi.colors.lightGray50
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
// Space for shortcut key or disclosure icon.
|
||||
id: tail
|
||||
|
|
|
@ -71,6 +71,7 @@ Item {
|
|||
readonly property color baseGrayShadow25: "#40252525"
|
||||
readonly property color baseGrayHighlight40: "#66575757"
|
||||
readonly property color baseGrayHighlight15: "#26575757"
|
||||
readonly property color lightGray50: "#806a6a6a"
|
||||
readonly property color lightGrayText80: "#ccafafaf"
|
||||
readonly property color faintGray80: "#cce3e3e3"
|
||||
readonly property color faintGray50: "#80e3e3e3"
|
||||
|
|
|
@ -190,6 +190,20 @@ void VrMenu::addAction(QMenu* menu, QAction* action) {
|
|||
bindActionToQmlAction(result, action);
|
||||
}
|
||||
|
||||
void VrMenu::addSeparator(QMenu* menu) {
|
||||
Q_ASSERT(MenuUserData::forObject(menu));
|
||||
MenuUserData* userData = MenuUserData::forObject(menu);
|
||||
if (!userData) {
|
||||
return;
|
||||
}
|
||||
QObject* menuQml = findMenuObject(userData->uuid.toString());
|
||||
Q_ASSERT(menuQml);
|
||||
|
||||
bool invokeResult = QMetaObject::invokeMethod(menuQml, "addSeparator", Qt::DirectConnection);
|
||||
Q_ASSERT(invokeResult);
|
||||
Q_UNUSED(invokeResult); // FIXME - apparently we haven't upgraded the Qt on our unix Jenkins environments to 5.5.x
|
||||
}
|
||||
|
||||
void VrMenu::insertAction(QAction* before, QAction* action) {
|
||||
QObject* beforeQml{ nullptr };
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
VrMenu(QObject* parent = nullptr);
|
||||
void addMenu(QMenu* menu);
|
||||
void addAction(QMenu* parent, QAction* action);
|
||||
void addSeparator(QMenu* parent);
|
||||
void insertAction(QAction* before, QAction* action);
|
||||
void removeAction(QAction* action);
|
||||
|
||||
|
|
|
@ -511,7 +511,11 @@ void MenuWrapper::setEnabled(bool enabled) {
|
|||
}
|
||||
|
||||
QAction* MenuWrapper::addSeparator() {
|
||||
return _realMenu->addSeparator();
|
||||
QAction* action = _realMenu->addSeparator();
|
||||
VrMenu::executeOrQueue([=](VrMenu* vrMenu) {
|
||||
vrMenu->addSeparator(_realMenu);
|
||||
});
|
||||
return action;
|
||||
}
|
||||
|
||||
void MenuWrapper::addAction(QAction* action) {
|
||||
|
|
Loading…
Reference in a new issue