From 541d0ab4d689b2cc50eecb00128210480576105b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 3 Dec 2018 17:33:04 -0800 Subject: [PATCH] work around menu-item name hash collision for Home --- interface/src/Menu.h | 2 +- libraries/ui/src/ui/Menu.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/interface/src/Menu.h b/interface/src/Menu.h index e0e48ff32c..7168b7294e 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -117,7 +117,7 @@ namespace MenuOption { const QString FrameTimer = "Show Timer"; const QString FullscreenMirror = "Mirror"; const QString Help = "Help..."; - const QString HomeLocation = "Home"; + const QString HomeLocation = "Home "; const QString IncreaseAvatarSize = "Increase Avatar Size"; const QString IndependentMode = "Independent Mode"; const QString ActionMotorControl = "Enable Default Motor Control"; diff --git a/libraries/ui/src/ui/Menu.h b/libraries/ui/src/ui/Menu.h index 2977a5330a..ec286b29ad 100644 --- a/libraries/ui/src/ui/Menu.h +++ b/libraries/ui/src/ui/Menu.h @@ -146,6 +146,11 @@ protected: int findPositionOfMenuItem(MenuWrapper* menu, const QString& searchMenuItem); int positionBeforeSeparatorIfNeeded(MenuWrapper* menu, int requestedPosition); + // There is a design flaw here -- _actionHash is system-wide and hashes the names of menu-items to their + // QActions. The path (parent submenu name etc) isn't included in the hash key. This generally works, + // but we add "Home" twice -- once for "go home" and once for "set startup location to home". Anytime + // a user bookmarks a place and gives it a name like an existing menu-item, something will go wrong. + // TODO: change the js api to require the full path when referring to a specific menu item. QHash _actionHash; bool isValidGrouping(const QString& grouping) const { return grouping == "Advanced" || grouping == "Developer"; }