History

fix operations of two different enums

RTUnreal committed 1 year ago

Commit b306e211 parent 2d96c024 files · +19 −15Browse files

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

Unified · Split

interface/src/Menu.cpp+11−8
@@ -15,6 +15,9 @@ · 14 unmodified lines
15// This forces QML files to be pulled from the source as you edit it: set environment variable HIFI_USE_SOURCE_TREE_RESOURCES=115// This forces QML files to be pulled from the source as you edit it: set environment variable HIFI_USE_SOURCE_TREE_RESOURCES=1
16// Use this to live reload: DependencyManager::get<OffscreenUi>()->clearCache();16// Use this to live reload: DependencyManager::get<OffscreenUi>()->clearCache();
17 17
18
19// QT6TODO: The Key Enums should be replaced by QKeyCombination in Qt6
20
18#include "Menu.h"21#include "Menu.h"
19#include <QDesktopServices>22#include <QDesktopServices>
20#include <QFileDialog>23#include <QFileDialog>
@@ -106,7 +109,7 @@ Menu::Menu() { · 85 unmodified lines
106 });109 });
107 110
108 // File > Quit111 // File > Quit
109 addActionToQMenuAndActionHash(fileMenu, MenuOption::Quit, Qt::CTRL | Qt::Key_Q, qApp, SLOT(quit()), QAction::QuitRole);112 addActionToQMenuAndActionHash(fileMenu, MenuOption::Quit, static_cast<int>(Qt::CTRL) | static_cast<int>(Qt::Key_Q), qApp, SLOT(quit()), QAction::QuitRole);
110 113
111 114
112 // Edit menu ----------------------------------115 // Edit menu ----------------------------------
@@ -143,7 +146,7 @@ Menu::Menu() { · 30 unmodified lines
143 editMenu->addSeparator();146 editMenu->addSeparator();
144 147
145 // Edit > Running Scripts148 // Edit > Running Scripts
146 auto action = addActionToQMenuAndActionHash(editMenu, MenuOption::RunningScripts, Qt::CTRL | Qt::Key_J);149 auto action = addActionToQMenuAndActionHash(editMenu, MenuOption::RunningScripts, static_cast<int>(Qt::CTRL) | static_cast<int>(Qt::Key_J));
147 connect(action, &QAction::triggered, [] {150 connect(action, &QAction::triggered, [] {
148 if (!qApp->getLoginDialogPoppedUp()) {151 if (!qApp->getLoginDialogPoppedUp()) {
149 static const QUrl widgetUrl("hifi/dialogs/RunningScripts.qml");152 static const QUrl widgetUrl("hifi/dialogs/RunningScripts.qml");
@@ -157,7 +160,7 @@ Menu::Menu() { · 7 unmodified lines
157 160
158 // Edit > Asset Browser161 // Edit > Asset Browser
159 auto assetServerAction = addActionToQMenuAndActionHash(editMenu, MenuOption::AssetServer,162 auto assetServerAction = addActionToQMenuAndActionHash(editMenu, MenuOption::AssetServer,
160 Qt::CTRL | Qt::SHIFT | Qt::Key_A,163 static_cast<int>(Qt::CTRL | Qt::SHIFT) | static_cast<int>(Qt::Key_A),
161 qApp, SLOT(showAssetServerWidget()));164 qApp, SLOT(showAssetServerWidget()));
162 {165 {
163 auto nodeList = DependencyManager::get<NodeList>();166 auto nodeList = DependencyManager::get<NodeList>();
@@ -253,7 +256,7 @@ Menu::Menu() { · 89 unmodified lines
253 MenuWrapper* settingsMenu = addMenu("Settings");256 MenuWrapper* settingsMenu = addMenu("Settings");
254 257
255 // Settings > General...258 // Settings > General...
256 action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::Preferences, Qt::CTRL | Qt::Key_G, nullptr, nullptr);259 action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::Preferences, static_cast<int>(Qt::CTRL) | static_cast<int>(Qt::Key_G), nullptr, nullptr);
257 connect(action, &QAction::triggered, [] {260 connect(action, &QAction::triggered, [] {
258 if (!qApp->getLoginDialogPoppedUp()) {261 if (!qApp->getLoginDialogPoppedUp()) {
259 qApp->showDialog(QString("hifi/dialogs/GeneralPreferencesDialog.qml"),262 qApp->showDialog(QString("hifi/dialogs/GeneralPreferencesDialog.qml"),
@@ -337,7 +340,7 @@ Menu::Menu() { · 77 unmodified lines
337 MenuWrapper* scriptingOptionsMenu = developerMenu->addMenu("Scripting");340 MenuWrapper* scriptingOptionsMenu = developerMenu->addMenu("Scripting");
338 341
339 // Developer > Scripting > Console...342 // Developer > Scripting > Console...
340 addActionToQMenuAndActionHash(scriptingOptionsMenu, MenuOption::Console, Qt::CTRL | Qt::ALT | Qt::Key_J,343 addActionToQMenuAndActionHash(scriptingOptionsMenu, MenuOption::Console, static_cast<int>(Qt::CTRL | Qt::ALT) | static_cast<int>(Qt::Key_J),
341 DependencyManager::get<StandAloneJSConsole>().data(),344 DependencyManager::get<StandAloneJSConsole>().data(),
342 SLOT(toggleConsole()),345 SLOT(toggleConsole()),
343 QAction::NoRole,346 QAction::NoRole,
@@ -379,7 +382,7 @@ Menu::Menu() { · 35 unmodified lines
379#if defined(Q_OS_MAC) || defined(Q_OS_WIN)382#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
380 auto speechRecognizer = DependencyManager::get<SpeechRecognizer>();383 auto speechRecognizer = DependencyManager::get<SpeechRecognizer>();
381 QAction* speechRecognizerAction = addCheckableActionToQMenuAndActionHash(scriptingOptionsMenu, MenuOption::ControlWithSpeech,384 QAction* speechRecognizerAction = addCheckableActionToQMenuAndActionHash(scriptingOptionsMenu, MenuOption::ControlWithSpeech,
382 Qt::CTRL | Qt::SHIFT | Qt::Key_C,385 static_cast<int>(Qt::CTRL | Qt::SHIFT) | static_cast<int>(Qt::Key_C),
383 speechRecognizer->getEnabled(),386 speechRecognizer->getEnabled(),
384 speechRecognizer.data(),387 speechRecognizer.data(),
385 SLOT(setEnabled(bool)),388 SLOT(setEnabled(bool)),
@@ -815,7 +818,7 @@ Menu::Menu() { · 429 unmodified lines
815 addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::AnimStats);818 addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::AnimStats);
816 819
817 // Developer > Log820 // Developer > Log
818 addActionToQMenuAndActionHash(developerMenu, MenuOption::Log, Qt::CTRL | Qt::SHIFT | Qt::Key_L,821 addActionToQMenuAndActionHash(developerMenu, MenuOption::Log, static_cast<int>(Qt::CTRL | Qt::SHIFT) | static_cast<int>(Qt::Key_L),
819 qApp, SLOT(toggleLogDialog()));822 qApp, SLOT(toggleLogDialog()));
820 823
821#if 0 /// -------------- REMOVED FOR NOW --------------824#if 0 /// -------------- REMOVED FOR NOW --------------
@@ -834,7 +837,7 @@ Menu::Menu() { · 12 unmodified lines
834 MenuWrapper* toolsMenu = addMenu("Tools");837 MenuWrapper* toolsMenu = addMenu("Tools");
835 addActionToQMenuAndActionHash(toolsMenu,838 addActionToQMenuAndActionHash(toolsMenu,
836 MenuOption::ToolWindow,839 MenuOption::ToolWindow,
837 Qt::CTRL | Qt::ALT | Qt::Key_T,840 static_cast<int>(Qt::CTRL | Qt::ALT) | static_cast<int>(Qt::Key_T),
838 dialogsManager.data(),841 dialogsManager.data(),
839 SLOT(toggleToolWindow()),842 SLOT(toggleToolWindow()),
840 QAction::NoRole, UNSPECIFIED_POSITION, "Advanced");843 QAction::NoRole, UNSPECIFIED_POSITION, "Advanced");