History

Merge branch 'master' of https://github.com/highfidelity/hifi into authentication

Stephen Birarda committed 12 years ago

Commit 66817542 parents ea61ccf 8e097be38 files · +1152 −268Browse files

Showing the changes to interface/src/Menu.cpp (1 of 38 files). Show all

Unified · Split

interface/src/Menu.cpp+45−1
@@ -161,6 +161,15 @@ Menu::Menu() : · 160 unmodified lines
161161
162162
163163 QMenu* editMenu = addMenu("Edit");
164+
165+ QUndoStack* undoStack = Application::getInstance()->getUndoStack();
166+ QAction* undoAction = undoStack->createUndoAction(editMenu);
167+ undoAction->setShortcut(Qt::CTRL | Qt::Key_Z);
168+ addActionToQMenuAndActionHash(editMenu, undoAction);
169+
170+ QAction* redoAction = undoStack->createRedoAction(editMenu);
171+ redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z);
172+ addActionToQMenuAndActionHash(editMenu, redoAction);
164173
165174 addActionToQMenuAndActionHash(editMenu,
166175 MenuOption::Preferences,
@@ -183,7 +192,7 @@ Menu::Menu() : · 16 unmodified lines
183192 #ifdef HAVE_QXMPP
184193 _chatAction = addActionToQMenuAndActionHash(toolsMenu,
185194 MenuOption::Chat,
186− Qt::Key_Return,
195+ 0,
187196 this,
188197 SLOT(showChat()));
189198
@@ -620,6 +629,41 @@ QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu, · 430 unmodified lines
620629 return action;
621630 }
622631
632+QAction* Menu::addActionToQMenuAndActionHash(QMenu* destinationMenu,
633+ QAction* action,
634+ const QString& actionName,
635+ const QKeySequence& shortcut,
636+ QAction::MenuRole role,
637+ int menuItemLocation) {
638+ QAction* actionBefore = NULL;
639+
640+ if (menuItemLocation >= 0 && destinationMenu->actions().size() > menuItemLocation) {
641+ actionBefore = destinationMenu->actions()[menuItemLocation];
642+ }
643+
644+ if (!actionName.isEmpty()) {
645+ action->setText(actionName);
646+ }
647+
648+ if (shortcut != 0) {
649+ action->setShortcut(shortcut);
650+ }
651+
652+ if (role != QAction::NoRole) {
653+ action->setMenuRole(role);
654+ }
655+
656+ if (!actionBefore) {
657+ destinationMenu->addAction(action);
658+ } else {
659+ destinationMenu->insertAction(actionBefore, action);
660+ }
661+
662+ _actionHash.insert(action->text(), action);
663+
664+ return action;
665+}
666+
623667 QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu,
624668 const QString& actionName,
625669 const QKeySequence& shortcut,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t