Themes: Lighter toolbar borders

The toolbar border/separator lines for flat themes need to be a bit
lighter.

This change introduces StyleHelper::toolBarBorderColor and puts it into
use for drawing all toolbar borders.

Change-Id: Icef20759ce282e768f6ba867474e506b9230b864
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
This commit is contained in:
Alessandro Portale
2016-07-19 18:24:25 +02:00
parent 0a72e887aa
commit 276b20409d
4 changed files with 26 additions and 11 deletions

View File

@@ -153,6 +153,14 @@ QColor StyleHelper::borderColor(bool lightColored)
return result;
}
QColor StyleHelper::toolBarBorderColor()
{
const QColor base = baseColor();
return QColor::fromHsv(base.hue(),
base.saturation() ,
clamp(base.value() * 0.80f));
}
// We try to ensure that the actual color used are within
// reasonalbe bounds while generating the actual baseColor
// from the users request.

View File

@@ -59,6 +59,7 @@ public:
static QColor highlightColor(bool lightColored = false);
static QColor shadowColor(bool lightColored = false);
static QColor borderColor(bool lightColored = false);
static QColor toolBarBorderColor();
static QColor buttonTextColor() { return QColor(0x4c4c4c); }
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50);
static QColor alphaBlendedColors(const QColor &colorA, const QColor &colorB);

View File

@@ -418,7 +418,7 @@ public:
if (!creatorTheme()->flag(Theme::DrawToolBarHighlights)
&& !creatorTheme()->flag(Theme::DrawToolBarBorders)) {
QPainter p(this);
p.setPen(StyleHelper::borderColor());
p.setPen(StyleHelper::toolBarBorderColor());
const QRectF innerRect = QRectF(rect()).adjusted(0.5, 0.5, -0.5, -0.5);
p.drawLine(innerRect.bottomLeft(), innerRect.bottomRight());
}
@@ -528,6 +528,11 @@ void FancyTabWidget::paintEvent(QPaintEvent *event)
QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0);
rect = style()->visualRect(layoutDirection(), geometry(), rect);
const QRectF boderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
if (creatorTheme()->flag(Theme::FlatToolBars)) {
painter.setPen(StyleHelper::toolBarBorderColor());
painter.drawLine(boderRect.topRight(), boderRect.bottomRight());
} else {
StyleHelper::verticalGradient(&painter, rect, rect);
painter.setPen(StyleHelper::borderColor());
painter.drawLine(boderRect.topRight(), boderRect.bottomRight());
@@ -536,6 +541,7 @@ void FancyTabWidget::paintEvent(QPaintEvent *event)
painter.setPen(light);
painter.drawLine(boderRect.bottomLeft(), boderRect.bottomRight());
}
}
}
void FancyTabWidget::insertCornerWidget(int pos, QWidget *widget)

View File

@@ -541,7 +541,7 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
}
if (creatorTheme()->flag(Theme::DrawToolBarBorders)) {
painter->setPen(StyleHelper::borderColor());
painter->setPen(StyleHelper::toolBarBorderColor());
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
}
painter->restore();
@@ -800,7 +800,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
StyleHelper::menuGradient(painter, option->rect, option->rect);
painter->save();
painter->setPen(StyleHelper::borderColor());
painter->setPen(StyleHelper::toolBarBorderColor());
painter->drawLine(option->rect.bottomLeft() + QPointF(0.5, 0.5),
option->rect.bottomRight() + QPointF(0.5, 0.5));
painter->restore();
@@ -832,7 +832,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
if (creatorTheme()->flag(Theme::DrawToolBarHighlights)) {
if (!drawLightColored)
painter->setPen(StyleHelper::borderColor());
painter->setPen(StyleHelper::toolBarBorderColor());
else
painter->setPen(QColor(0x888888));
@@ -860,7 +860,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
}
}
if (creatorTheme()->flag(Theme::DrawToolBarBorders)) {
painter->setPen(StyleHelper::borderColor());
painter->setPen(StyleHelper::toolBarBorderColor());
if (widget && widget->property("topBorder").toBool())
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
else