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 <tobias.hunger@theqtcompany.com>
This commit is contained in:
Alessandro Portale
2016-03-13 01:24:07 +01:00
parent b6c1e58f58
commit 04a68518c9
5 changed files with 9 additions and 5 deletions

View File

@@ -175,6 +175,7 @@ DrawToolBarHighlights=true
ApplyThemePaletteGlobally=true ApplyThemePaletteGlobally=true
FlatSideBarIcons=true FlatSideBarIcons=true
FlatProjectsMode=true FlatProjectsMode=true
FlatMenuBar=true
[Gradients] [Gradients]
DetailsWidgetHeaderGradient\1\color=0 DetailsWidgetHeaderGradient\1\color=0

View File

@@ -77,8 +77,8 @@ InfoBarBackground=ffffffe1
InfoBarText=text InfoBarText=text
MenuBarEmptyAreaBackgroundColor=shadowBackground MenuBarEmptyAreaBackgroundColor=shadowBackground
MenuBarItemBackgroundColor=shadowBackground MenuBarItemBackgroundColor=shadowBackground
MenuBarItemTextColorDisabled=toolBarItemDisabled MenuBarItemTextColorDisabled=textDisabled
MenuBarItemTextColorNormal=toolBarItem MenuBarItemTextColorNormal=text
MenuItemTextColorDisabled=textDisabled MenuItemTextColorDisabled=textDisabled
MenuItemTextColorNormal=text MenuItemTextColorNormal=text
MiniProjectTargetSelectorBackgroundColor=shadowBackground MiniProjectTargetSelectorBackgroundColor=shadowBackground
@@ -177,6 +177,7 @@ DrawToolBarHighlights=false
ApplyThemePaletteGlobally=false ApplyThemePaletteGlobally=false
FlatSideBarIcons=true FlatSideBarIcons=true
FlatProjectsMode=false FlatProjectsMode=false
FlatMenuBar=false
[Gradients] [Gradients]
DetailsWidgetHeaderGradient\1\color=0 DetailsWidgetHeaderGradient\1\color=0

View File

@@ -169,6 +169,7 @@ DrawToolBarHighlights=true
ApplyThemePaletteGlobally=false ApplyThemePaletteGlobally=false
FlatSideBarIcons=false FlatSideBarIcons=false
FlatProjectsMode=false FlatProjectsMode=false
FlatMenuBar=false
[Gradients] [Gradients]
DetailsWidgetHeaderGradient\1\color=ffffff DetailsWidgetHeaderGradient\1\color=ffffff

View File

@@ -261,7 +261,8 @@ public:
DerivePaletteFromTheme, DerivePaletteFromTheme,
ApplyThemePaletteGlobally, ApplyThemePaletteGlobally,
FlatSideBarIcons, FlatSideBarIcons,
FlatProjectsMode FlatProjectsMode,
FlatMenuBar
}; };
enum WidgetStyle { enum WidgetStyle {

View File

@@ -651,7 +651,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
const bool act = mbi->state & (State_Sunken | State_Selected); const bool act = mbi->state & (State_Sunken | State_Selected);
const bool dis = !(mbi->state & State_Enabled); const bool dis = !(mbi->state & State_Enabled);
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) if (creatorTheme()->flag(Theme::FlatMenuBar))
painter->fillRect(option->rect, StyleHelper::isBaseColorDefault() painter->fillRect(option->rect, StyleHelper::isBaseColorDefault()
? creatorTheme()->color(Theme::MenuBarItemBackgroundColor) ? creatorTheme()->color(Theme::MenuBarItemBackgroundColor)
: StyleHelper::baseColor()); : StyleHelper::baseColor());
@@ -784,7 +784,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
break; break;
case CE_MenuBarEmptyArea: { case CE_MenuBarEmptyArea: {
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) { if (!creatorTheme()->flag(Theme::FlatMenuBar)) {
StyleHelper::menuGradient(painter, option->rect, option->rect); StyleHelper::menuGradient(painter, option->rect, option->rect);
painter->save(); painter->save();
painter->setPen(StyleHelper::borderColor()); painter->setPen(StyleHelper::borderColor());