wire stuff up

This commit is contained in:
RickyRister 2024-10-21 02:33:24 -07:00
parent b0638daa6c
commit d88d694bf3
3 changed files with 12 additions and 0 deletions

View file

@ -326,6 +326,8 @@ AppearanceSettingsPage::AppearanceSettingsPage()
// Menu settings
showShortcutsCheckBox.setChecked(settings.getShowShortcuts());
connect(&showShortcutsCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &AppearanceSettingsPage::showShortcutsChanged);
auto *menuGrid = new QGridLayout;
menuGrid->addWidget(&showShortcutsCheckBox, 0, 0);
@ -426,6 +428,12 @@ void AppearanceSettingsPage::openThemeLocation()
}
}
void AppearanceSettingsPage::showShortcutsChanged(QT_STATE_CHANGED_T value)
{
SettingsCache::instance().setShowShortcuts(value);
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, value == 0); // 0 = unchecked
}
void AppearanceSettingsPage::retranslateUi()
{
themeGroupBox->setTitle(tr("Theme settings"));

View file

@ -83,6 +83,7 @@ class AppearanceSettingsPage : public AbstractSettingsPage
private slots:
void themeBoxChanged(int index);
void openThemeLocation();
void showShortcutsChanged(QT_STATE_CHANGED_T enabled);
private:
QLabel themeLabel;

View file

@ -180,6 +180,9 @@ int main(int argc, char *argv[])
ui.show();
qDebug("main(): ui.show() finished");
// If enabled, force shortcuts to be shown in right-click menus regardless of system defaults
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, !SettingsCache::instance().getShowShortcuts());
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif