forked from qt-creator/qt-creator
Themes: Enable UI recoloring for flat themes
Change-Id: I1907c42a769124b7505bd7afaf6c4da910f3f407 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -6,9 +6,9 @@ DefaultTextEditorColorScheme=dark.xml
|
||||
[Palette]
|
||||
shadowBackground=ff232323
|
||||
text=ffe7e7e7
|
||||
textDisabled=ff909090
|
||||
hoverBackground=ff515151
|
||||
selectedBackground=ff151515
|
||||
textDisabled=7fffffff
|
||||
hoverBackground=35ffffff
|
||||
selectedBackground=66000000
|
||||
normalBackground=ff333333
|
||||
alternateBackground=ff515151
|
||||
error=ffff0000
|
||||
@@ -19,7 +19,7 @@ BackgroundColorDark=shadowBackground
|
||||
BackgroundColorHover=hoverBackground
|
||||
BackgroundColorNormal=normalBackground
|
||||
BackgroundColorDisabled=ff444444
|
||||
BackgroundColorSelected=ff909090
|
||||
BackgroundColorSelected=7effffff
|
||||
BadgeLabelBackgroundColorChecked=normalBackground
|
||||
BadgeLabelBackgroundColorUnchecked=selectedBackground
|
||||
BadgeLabelTextColorChecked=text
|
||||
|
||||
@@ -108,6 +108,11 @@ QColor StyleHelper::baseColor(bool lightColored)
|
||||
return m_baseColor.lighter(230);
|
||||
}
|
||||
|
||||
bool StyleHelper::isBaseColorDefault()
|
||||
{
|
||||
return m_requestedBaseColor == DEFAULT_BASE_COLOR;
|
||||
}
|
||||
|
||||
QColor StyleHelper::highlightColor(bool lightColored)
|
||||
{
|
||||
QColor result = baseColor(lightColored);
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
// This is our color table, all colors derive from baseColor
|
||||
static QColor requestedBaseColor() { return m_requestedBaseColor; }
|
||||
static QColor baseColor(bool lightColored = false);
|
||||
static bool isBaseColorDefault();
|
||||
static QColor panelTextColor(bool lightColored = false);
|
||||
static QColor highlightColor(bool lightColored = false);
|
||||
static QColor shadowColor(bool lightColored = false);
|
||||
|
||||
@@ -272,7 +272,9 @@ void FancyActionBar::paintEvent(QPaintEvent *event)
|
||||
if (creatorTheme()->widgetStyle () == Theme::StyleFlat) {
|
||||
// this paints the background of the bottom portion of the
|
||||
// left tab bar
|
||||
painter.fillRect(event->rect(), creatorTheme()->color(Theme::FancyTabBarBackgroundColor));
|
||||
painter.fillRect(event->rect(), StyleHelper::isBaseColorDefault()
|
||||
? creatorTheme()->color(Theme::FancyTabBarBackgroundColor)
|
||||
: StyleHelper::baseColor());
|
||||
}
|
||||
|
||||
QColor light = StyleHelper::sidebarHighlight();
|
||||
|
||||
@@ -119,7 +119,9 @@ void FancyTabBar::paintEvent(QPaintEvent *event)
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) {
|
||||
// draw background of upper part of left tab widget
|
||||
// (Welcome, ... Help)
|
||||
p.fillRect (event->rect(), creatorTheme()->color(Theme::FancyTabBarBackgroundColor));
|
||||
p.fillRect(event->rect(), StyleHelper::isBaseColorDefault()
|
||||
? creatorTheme()->color(Theme::FancyTabBarBackgroundColor)
|
||||
: StyleHelper::baseColor());
|
||||
}
|
||||
|
||||
for (int i = 0; i < count(); ++i)
|
||||
@@ -320,14 +322,11 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
|
||||
const float fader = m_tabs[tabIndex]->fader();
|
||||
if (fader > 0 && !HostOsInfo::isMacHost() && !selected && enabled) {
|
||||
painter->save();
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) {
|
||||
QColor c = creatorTheme()->color(Theme::BackgroundColorHover);
|
||||
c.setAlpha(255 * fader);
|
||||
painter->fillRect(rect, c);
|
||||
} else {
|
||||
painter->setOpacity(fader);
|
||||
painter->setOpacity(fader);
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleFlat)
|
||||
painter->fillRect(rect, creatorTheme()->color(Theme::BackgroundColorHover));
|
||||
else
|
||||
FancyToolButton::hoverOverlay(painter, rect);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
|
||||
@@ -664,7 +664,9 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
const bool dis = !(mbi->state & State_Enabled);
|
||||
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleFlat)
|
||||
painter->fillRect(option->rect, creatorTheme()->color(Theme::MenuBarItemBackgroundColor));
|
||||
painter->fillRect(option->rect, StyleHelper::isBaseColorDefault()
|
||||
? creatorTheme()->color(Theme::MenuBarItemBackgroundColor)
|
||||
: StyleHelper::baseColor());
|
||||
else
|
||||
StyleHelper::menuGradient(painter, option->rect, option->rect);
|
||||
|
||||
@@ -802,7 +804,9 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
option->rect.bottomRight() + QPointF(0.5, 0.5));
|
||||
painter->restore();
|
||||
} else {
|
||||
painter->fillRect(option->rect, creatorTheme()->color(Theme::MenuBarEmptyAreaBackgroundColor));
|
||||
painter->fillRect(option->rect, StyleHelper::isBaseColorDefault()
|
||||
? creatorTheme()->color(Theme::MenuBarEmptyAreaBackgroundColor)
|
||||
: StyleHelper::baseColor());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -824,7 +828,9 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
||||
bool drawLightColored = lightColored(widget);
|
||||
// draws the background of the 'Type hierarchy', 'Projects' headers
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleFlat)
|
||||
painter->fillRect (rect, creatorTheme()->color(Theme::ToolBarBackgroundColor));
|
||||
painter->fillRect(rect, StyleHelper::isBaseColorDefault()
|
||||
? creatorTheme()->color(Theme::ToolBarBackgroundColor)
|
||||
: StyleHelper::baseColor(drawLightColored));
|
||||
else if (horizontal)
|
||||
StyleHelper::horizontalGradient(painter, gradientSpan, rect, drawLightColored);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user