diff options
-rw-r--r-- | share/qtcreator/themes/dark.creatortheme | 2 | ||||
-rw-r--r-- | share/qtcreator/themes/default.creatortheme | 2 | ||||
-rw-r--r-- | src/libs/utils/theme/theme.cpp | 2 | ||||
-rw-r--r-- | src/libs/utils/theme/theme.h | 2 | ||||
-rw-r--r-- | src/plugins/coreplugin/manhattanstyle.cpp | 23 |
5 files changed, 29 insertions, 2 deletions
diff --git a/share/qtcreator/themes/dark.creatortheme b/share/qtcreator/themes/dark.creatortheme index 0f49468454..54721a7627 100644 --- a/share/qtcreator/themes/dark.creatortheme +++ b/share/qtcreator/themes/dark.creatortheme @@ -53,6 +53,8 @@ MenuBarEmptyAreaBackgroundColor=shadowBackground MenuBarItemBackgroundColor=shadowBackground MenuBarItemTextColorDisabled=textDisabled MenuBarItemTextColorNormal=text +MenuItemTextColorDisabled=textDisabled +MenuItemTextColorNormal=text MiniProjectTargetSelectorBackgroundColor=shadowBackground MiniProjectTargetSelectorBorderColor=shadowBackground MiniProjectTargetSelectorSummaryBackgroundColor=shadowBackground diff --git a/share/qtcreator/themes/default.creatortheme b/share/qtcreator/themes/default.creatortheme index 5c02e74c11..27867b3d5f 100644 --- a/share/qtcreator/themes/default.creatortheme +++ b/share/qtcreator/themes/default.creatortheme @@ -47,6 +47,8 @@ MenuBarEmptyAreaBackgroundColor=ffff0000 MenuBarItemBackgroundColor=ffff0000 MenuBarItemTextColorDisabled=ffa0a0a4 MenuBarItemTextColorNormal=ff000000 +MenuItemTextColorDisabled=style +MenuItemTextColorNormal=style MiniProjectTargetSelectorBackgroundColor=ffa0a0a0 MiniProjectTargetSelectorBorderColor=ff000000 MiniProjectTargetSelectorSummaryBackgroundColor=ff464646 diff --git a/src/libs/utils/theme/theme.cpp b/src/libs/utils/theme/theme.cpp index c6a37e3c1e..13843d3dd5 100644 --- a/src/libs/utils/theme/theme.cpp +++ b/src/libs/utils/theme/theme.cpp @@ -113,6 +113,8 @@ QPair<QColor, QString> Theme::readNamedColor(const QString &color) const { if (d->palette.contains(color)) return qMakePair(d->palette[color], color); + if (color == QLatin1String("style")) + return qMakePair(QColor(), QString()); bool ok = true; const QRgb rgba = color.toLongLong(&ok, 16); diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h index 847b1e4bbf..1567532cee 100644 --- a/src/libs/utils/theme/theme.h +++ b/src/libs/utils/theme/theme.h @@ -98,6 +98,8 @@ public: MenuBarItemBackgroundColor, MenuBarItemTextColorDisabled, MenuBarItemTextColorNormal, + MenuItemTextColorDisabled, + MenuItemTextColorNormal, MiniProjectTargetSelectorBackgroundColor, MiniProjectTargetSelectorBorderColor, MiniProjectTargetSelectorSummaryBackgroundColor, diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 52074ffc57..9326552159 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -359,7 +359,7 @@ int ManhattanStyle::styleHint(StyleHint hint, const QStyleOption *option, const ret = true; break; case QStyle::SH_EtchDisabledText: - if (panelWidget(widget)) + if (panelWidget(widget) || qobject_cast<const QMenu *> (widget) ) ret = false; break; case QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren: @@ -614,7 +614,7 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { - if (!panelWidget(widget)) + if (!panelWidget(widget) && !qobject_cast<const QMenu *>(widget)) return QProxyStyle::drawControl(element, option, painter, widget); switch (element) { @@ -645,6 +645,25 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt } break; + case CE_MenuItem: + painter->save(); + if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { + const bool enabled = mbi->state & State_Enabled; + QStyleOptionMenuItem item = *mbi; + item.rect = mbi->rect; + const QColor color = creatorTheme()->color(enabled + ? Theme::MenuItemTextColorNormal + : Theme::MenuItemTextColorDisabled); + if (color.isValid()) { + QPalette pal = mbi->palette; + pal.setBrush(QPalette::Text, color); + item.palette = pal; + } + QProxyStyle::drawControl(element, &item, painter, widget); + } + painter->restore(); + break; + case CE_MenuBarItem: painter->save(); if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { |