From 04a68518c9608c8c575a2094611653cc24ee92bc Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Sun, 13 Mar 2016 01:24:07 +0100 Subject: [PATCH] Themes: Make theming of the menu bar optional Inspired by numerous user feedback, I want to turn off the theming of the menu bar for the new flat theme, and make it look like in the default theme. At the same time, I want to leave the "dark" theme as it currently is. This patch adds a theme flag FlatMenuBar and turns it off for the new theme. Change-Id: I9bba056a27fab7a634b45324e3fe8cd26f50df74 Reviewed-by: Tobias Hunger --- share/qtcreator/themes/dark.creatortheme | 1 + share/qtcreator/themes/darkframe.creatortheme | 5 +++-- share/qtcreator/themes/default.creatortheme | 1 + src/libs/utils/theme/theme.h | 3 ++- src/plugins/coreplugin/manhattanstyle.cpp | 4 ++-- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/share/qtcreator/themes/dark.creatortheme b/share/qtcreator/themes/dark.creatortheme index 7c74fcce6c0..5e2960266fd 100644 --- a/share/qtcreator/themes/dark.creatortheme +++ b/share/qtcreator/themes/dark.creatortheme @@ -175,6 +175,7 @@ DrawToolBarHighlights=true ApplyThemePaletteGlobally=true FlatSideBarIcons=true FlatProjectsMode=true +FlatMenuBar=true [Gradients] DetailsWidgetHeaderGradient\1\color=0 diff --git a/share/qtcreator/themes/darkframe.creatortheme b/share/qtcreator/themes/darkframe.creatortheme index 2203cd2bce7..946856fcc20 100644 --- a/share/qtcreator/themes/darkframe.creatortheme +++ b/share/qtcreator/themes/darkframe.creatortheme @@ -77,8 +77,8 @@ InfoBarBackground=ffffffe1 InfoBarText=text MenuBarEmptyAreaBackgroundColor=shadowBackground MenuBarItemBackgroundColor=shadowBackground -MenuBarItemTextColorDisabled=toolBarItemDisabled -MenuBarItemTextColorNormal=toolBarItem +MenuBarItemTextColorDisabled=textDisabled +MenuBarItemTextColorNormal=text MenuItemTextColorDisabled=textDisabled MenuItemTextColorNormal=text MiniProjectTargetSelectorBackgroundColor=shadowBackground @@ -177,6 +177,7 @@ DrawToolBarHighlights=false ApplyThemePaletteGlobally=false FlatSideBarIcons=true FlatProjectsMode=false +FlatMenuBar=false [Gradients] DetailsWidgetHeaderGradient\1\color=0 diff --git a/share/qtcreator/themes/default.creatortheme b/share/qtcreator/themes/default.creatortheme index 70c897834b3..64c4d9c122a 100644 --- a/share/qtcreator/themes/default.creatortheme +++ b/share/qtcreator/themes/default.creatortheme @@ -169,6 +169,7 @@ DrawToolBarHighlights=true ApplyThemePaletteGlobally=false FlatSideBarIcons=false FlatProjectsMode=false +FlatMenuBar=false [Gradients] DetailsWidgetHeaderGradient\1\color=ffffff diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h index d67303ce0f9..c8e9a57f0af 100644 --- a/src/libs/utils/theme/theme.h +++ b/src/libs/utils/theme/theme.h @@ -261,7 +261,8 @@ public: DerivePaletteFromTheme, ApplyThemePaletteGlobally, FlatSideBarIcons, - FlatProjectsMode + FlatProjectsMode, + FlatMenuBar }; enum WidgetStyle { diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 270d293c1e7..d3583fab311 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -651,7 +651,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt const bool act = mbi->state & (State_Sunken | State_Selected); const bool dis = !(mbi->state & State_Enabled); - if (creatorTheme()->widgetStyle() == Theme::StyleFlat) + if (creatorTheme()->flag(Theme::FlatMenuBar)) painter->fillRect(option->rect, StyleHelper::isBaseColorDefault() ? creatorTheme()->color(Theme::MenuBarItemBackgroundColor) : StyleHelper::baseColor()); @@ -784,7 +784,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt break; case CE_MenuBarEmptyArea: { - if (creatorTheme()->widgetStyle() == Theme::StyleDefault) { + if (!creatorTheme()->flag(Theme::FlatMenuBar)) { StyleHelper::menuGradient(painter, option->rect, option->rect); painter->save(); painter->setPen(StyleHelper::borderColor());