feat: Add empty menu

Signed-off-by: Redson <redson@riseup.net>
This commit is contained in:
Redson 2022-11-14 16:33:25 -03:00
parent 074b53eb6b
commit be765f8d88
No known key found for this signature in database
GPG Key ID: A55CD2880240ABD7
2 changed files with 28 additions and 0 deletions

View File

@ -264,6 +264,8 @@ public:
TranslatedAction actionLockToolbars; TranslatedAction actionLockToolbars;
TranslatedAction actionChangeTheme;
QVector<TranslatedToolButton *> all_toolbuttons; QVector<TranslatedToolButton *> all_toolbuttons;
QWidget *centralWidget = nullptr; QWidget *centralWidget = nullptr;
@ -428,6 +430,11 @@ public:
actionLockToolbars.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Lock Toolbars")); actionLockToolbars.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Lock Toolbars"));
actionLockToolbars->setCheckable(true); actionLockToolbars->setCheckable(true);
all_actions.append(&actionLockToolbars); all_actions.append(&actionLockToolbars);
actionChangeTheme = TranslatedAction(MainWindow);
actionChangeTheme->setObjectName(QStringLiteral("actionChangeTheme"));
actionChangeTheme.setTextId(QT_TRANSLATE_NOOP("MainWindow", "Themes"));
all_actions.append(&actionChangeTheme);
} }
void createMainToolbar(QMainWindow *MainWindow) void createMainToolbar(QMainWindow *MainWindow)
@ -528,6 +535,8 @@ public:
viewMenu = menuBar->addMenu(tr("&View")); viewMenu = menuBar->addMenu(tr("&View"));
viewMenu->setSeparatorsCollapsible(false); viewMenu->setSeparatorsCollapsible(false);
viewMenu->addAction(actionChangeTheme);
viewMenu->addSeparator();
viewMenu->addAction(actionCAT); viewMenu->addAction(actionCAT);
viewMenu->addSeparator(); viewMenu->addSeparator();
@ -822,6 +831,7 @@ public:
createInstanceToolbar(MainWindow); createInstanceToolbar(MainWindow);
MainWindow->updateToolsMenu(); MainWindow->updateToolsMenu();
MainWindow->updateThemeMenu();
retranslateUi(MainWindow); retranslateUi(MainWindow);
@ -1271,6 +1281,22 @@ void MainWindow::updateToolsMenu()
ui->actionLaunchInstance->setMenu(launchMenu); ui->actionLaunchInstance->setMenu(launchMenu);
} }
void MainWindow::updateThemeMenu()
{
QMenu *themeMenu = ui->actionChangeTheme->menu();
if (themeMenu)
{
themeMenu->clear();
}
else
{
themeMenu = new QMenu(this);
}
ui->actionChangeTheme->setMenu(themeMenu);
}
void MainWindow::repopulateAccountsMenu() void MainWindow::repopulateAccountsMenu()
{ {
accountMenu->clear(); accountMenu->clear();

View File

@ -170,6 +170,8 @@ private slots:
void updateToolsMenu(); void updateToolsMenu();
void updateThemeMenu();
void instanceActivated(QModelIndex); void instanceActivated(QModelIndex);
void instanceChanged(const QModelIndex &current, const QModelIndex &previous); void instanceChanged(const QModelIndex &current, const QModelIndex &previous);