Merge pull request #14528 from sethalves/fix-delete-home

work around menu-item name hash collision for Home
This commit is contained in:
Brad Hefta-Gaub 2018-12-04 15:04:25 -08:00 committed by GitHub
commit 77e1c98264
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -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";

View file

@ -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<QString, QAction*> _actionHash;
bool isValidGrouping(const QString& grouping) const { return grouping == "Advanced" || grouping == "Developer"; }