Themes: Make toolbar highlights optional

Following Diana's flat style motto "remove unnecessary lines", this
patch makes highlights and shadows in the toolbars optional, and removes
them for the new flat theme.

"default" and "dark" are not affected by this change.

Change-Id: Iadbbaa669e318406a154fed3e07890fd40f5f621
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Alessandro Portale
2016-03-04 11:08:46 +01:00
parent cfaba1a190
commit a0fbfd3bd4
5 changed files with 29 additions and 23 deletions

View File

@@ -830,32 +830,34 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
else
StyleHelper::verticalGradient(painter, gradientSpan, rect, drawLightColored);
if (!drawLightColored)
painter->setPen(StyleHelper::borderColor());
else
painter->setPen(QColor(0x888888));
if (creatorTheme()->flag(Theme::DrawToolBarHighlights)) {
if (!drawLightColored)
painter->setPen(StyleHelper::borderColor());
else
painter->setPen(QColor(0x888888));
if (horizontal) {
// Note: This is a hack to determine if the
// toolbar should draw the top or bottom outline
// (needed for the find toolbar for instance)
const QColor hightLight = creatorTheme()->widgetStyle() == Theme::StyleDefault
? StyleHelper::sidebarHighlight()
: creatorTheme()->color(Theme::FancyToolBarSeparatorColor);
const QColor borderColor = drawLightColored
? QColor(255, 255, 255, 180) : hightLight;
if (widget && widget->property("topBorder").toBool()) {
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
painter->setPen(borderColor);
painter->drawLine(borderRect.topLeft() + QPointF(0, 1), borderRect.topRight() + QPointF(0, 1));
if (horizontal) {
// Note: This is a hack to determine if the
// toolbar should draw the top or bottom outline
// (needed for the find toolbar for instance)
const QColor hightLight = creatorTheme()->widgetStyle() == Theme::StyleDefault
? StyleHelper::sidebarHighlight()
: creatorTheme()->color(Theme::FancyToolBarSeparatorColor);
const QColor borderColor = drawLightColored
? QColor(255, 255, 255, 180) : hightLight;
if (widget && widget->property("topBorder").toBool()) {
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
painter->setPen(borderColor);
painter->drawLine(borderRect.topLeft() + QPointF(0, 1), borderRect.topRight() + QPointF(0, 1));
} else {
painter->drawLine(borderRect.bottomLeft(), borderRect.bottomRight());
painter->setPen(borderColor);
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
}
} else {
painter->drawLine(borderRect.bottomLeft(), borderRect.bottomRight());
painter->setPen(borderColor);
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
painter->drawLine(borderRect.topLeft(), borderRect.bottomLeft());
painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
}
} else {
painter->drawLine(borderRect.topLeft(), borderRect.bottomLeft());
painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
}
}
break;