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