Commit 9135ad7b authored by Calvin Buckley's avatar Calvin Buckley 🤔
Browse files

Remove settings menu and set action roles for QCG

The roles will automatically move the actions to the macOS app menu
like a proper macOS application. As a result of this, on macOS, the
sidebar menu would be the only thing in Settings, so remove it and
rehome the items into View.
parent 09916794
...@@ -369,6 +369,7 @@ void QCGTopLevel::createActions() ...@@ -369,6 +369,7 @@ void QCGTopLevel::createActions()
this, &QCGTopLevel::recentFilesTriggered); this, &QCGTopLevel::recentFilesTriggered);
_exitAction = new QAction(tr("E&xit"), this); _exitAction = new QAction(tr("E&xit"), this);
_exitAction->setMenuRole(QAction::QuitRole);
_exitAction->setShortcut(tr("Ctrl+Q")); _exitAction->setShortcut(tr("Ctrl+Q"));
_exitAction->setStatusTip(tr("Exit the application")); _exitAction->setStatusTip(tr("Exit the application"));
connect(_exitAction, &QAction::triggered, this, &QWidget::close); connect(_exitAction, &QAction::triggered, this, &QWidget::close);
...@@ -546,15 +547,18 @@ void QCGTopLevel::createActions() ...@@ -546,15 +547,18 @@ void QCGTopLevel::createActions()
// settings menu actions // settings menu actions
_configureAction = new QAction(tr("&Configure..."), this); _configureAction = new QAction(tr("&Configure..."), this);
_configureAction->setMenuRole(QAction::PreferencesRole);
_configureAction->setStatusTip(tr("Configure QCachegrind")); _configureAction->setStatusTip(tr("Configure QCachegrind"));
connect(_configureAction, SIGNAL(triggered()), this, SLOT(configure())); connect(_configureAction, SIGNAL(triggered()), this, SLOT(configure()));
// help menu actions // help menu actions
_aboutAction = new QAction(tr("&About QCachegrind..."), this); _aboutAction = new QAction(tr("&About QCachegrind..."), this);
_aboutAction->setMenuRole(QAction::AboutRole);
_aboutAction->setStatusTip(tr("Show the application's About box")); _aboutAction->setStatusTip(tr("Show the application's About box"));
connect(_aboutAction, &QAction::triggered, this, &QCGTopLevel::about); connect(_aboutAction, &QAction::triggered, this, &QCGTopLevel::about);
_aboutQtAction = new QAction(tr("About Qt..."), this); _aboutQtAction = new QAction(tr("About Qt..."), this);
_aboutQtAction->setMenuRole(QAction::AboutQtRole);
connect(_aboutQtAction, &QAction::triggered, qApp, &QApplication::aboutQt); connect(_aboutQtAction, &QAction::triggered, qApp, &QApplication::aboutQt);
// toolbar actions // toolbar actions
...@@ -596,6 +600,7 @@ void QCGTopLevel::createMenu() ...@@ -596,6 +600,7 @@ void QCGTopLevel::createMenu()
viewMenu->addAction(_groupingMenuAction); viewMenu->addAction(_groupingMenuAction);
viewMenu->addSeparator(); viewMenu->addSeparator();
viewMenu->addMenu(layoutMenu); viewMenu->addMenu(layoutMenu);
viewMenu->addAction(_sidebarMenuAction);
viewMenu->addAction(_splittedToggleAction); viewMenu->addAction(_splittedToggleAction);
viewMenu->addAction(_splitDirectionToggleAction); viewMenu->addAction(_splitDirectionToggleAction);
viewMenu->addSeparator(); viewMenu->addSeparator();
...@@ -603,16 +608,14 @@ void QCGTopLevel::createMenu() ...@@ -603,16 +608,14 @@ void QCGTopLevel::createMenu()
viewMenu->addAction(_percentageToggleAction); viewMenu->addAction(_percentageToggleAction);
viewMenu->addAction(_expandedToggleAction); viewMenu->addAction(_expandedToggleAction);
viewMenu->addAction(_hideTemplatesToggleAction); viewMenu->addAction(_hideTemplatesToggleAction);
viewMenu->addSeparator();
viewMenu->addAction(_configureAction);
QMenu* goMenu = mBar->addMenu(tr("&Go")); QMenu* goMenu = mBar->addMenu(tr("&Go"));
goMenu->addAction(_backAction); goMenu->addAction(_backAction);
goMenu->addAction(_forwardAction); goMenu->addAction(_forwardAction);
goMenu->addAction(_upAction); goMenu->addAction(_upAction);
fileMenu->addAction(_exitAction);
QMenu* settingsMenu = mBar->addMenu(tr("&Settings"));
settingsMenu->addAction(_sidebarMenuAction);
settingsMenu->addSeparator();
settingsMenu->addAction(_configureAction);
QMenu* helpMenu = mBar->addMenu(tr("&Help")); QMenu* helpMenu = mBar->addMenu(tr("&Help"));
helpMenu->addAction(QWhatsThis::createAction(this)); helpMenu->addAction(QWhatsThis::createAction(this));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment