Commit 2434bafc authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[KHintsSettings] Update AA_DontShowIconsInMenus at runtime

CHANGELOG: Changing the "Show icons in menus" setting will now immediately be applied to running applications

Differential Revision: https://phabricator.kde.org/D7344
parent 1b21b597
......@@ -120,8 +120,7 @@ KHintsSettings::KHintsSettings(KSharedConfig::Ptr kdeglobals)
QApplication::setWheelScrollLines(cg.readEntry("WheelScrollLines", 3));
}
bool showIcons = cg.readEntry("ShowIconsInMenuItems", !QApplication::testAttribute(Qt::AA_DontShowIconsInMenus));
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !showIcons);
updateShowIconsInMenuItems(cg);
QMetaObject::invokeMethod(this, "delayedDBusConnects", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "setupIconLoader", Qt::QueuedConnection);
......@@ -250,6 +249,8 @@ void KHintsSettings::slotNotifyChange(int type, int arg)
} else if (category == SETTINGS_STYLE) {
m_hints[QPlatformTheme::DialogButtonBoxButtonsHaveIcons] = cg.readEntry("ShowIconsOnPushButtons", true);
m_hints[QPlatformTheme::UiEffects] = cg.readEntry("GraphicEffectsLevel", 0) != 0 ? QPlatformTheme::GeneralUiEffect : 0;
updateShowIconsInMenuItems(cg);
}
break;
}
......@@ -341,8 +342,7 @@ void KHintsSettings::updateQtSettings(KConfigGroup &cg)
m_hints[QPlatformTheme::ItemViewActivateItemOnSingleClick] = cg.readEntry("SingleClick", true);
bool showIcons = cg.readEntry("ShowIconsInMenuItems", !QApplication::testAttribute(Qt::AA_DontShowIconsInMenus));
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !showIcons);
updateShowIconsInMenuItems(cg);
int wheelScrollLines = cg.readEntry("WheelScrollLines", 3);
m_hints[QPlatformTheme::WheelScrollLines] = wheelScrollLines;
......@@ -352,6 +352,12 @@ void KHintsSettings::updateQtSettings(KConfigGroup &cg)
}
}
void KHintsSettings::updateShowIconsInMenuItems(KConfigGroup &cg)
{
bool showIcons = cg.readEntry("ShowIconsInMenuItems", true);
QCoreApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !showIcons);
}
Qt::ToolButtonStyle KHintsSettings::toolButtonStyle(const KConfigGroup &cg) const
{
const QString buttonStyle = cg.readEntry("ToolButtonStyle", "TextBesideIcon").toLower();
......
......@@ -76,6 +76,7 @@ private:
void loadPalettes();
void iconChanged(int group);
void updateQtSettings(KConfigGroup &cg);
void updateShowIconsInMenuItems(KConfigGroup &cg);
Qt::ToolButtonStyle toolButtonStyle(const KConfigGroup &cg) const;
void updateCursorTheme();
......
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