Themes: Draw optional toolbar borders

We need a new Theme flag for that. And it will initially only be set for
the flat light theme.

Task-number: QTCREATORBUG-16633
Change-Id: Id723e128364eb6186fe8e28e2087a3698b1bf632
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Alessandro Portale
2016-07-19 17:27:23 +02:00
parent f50f0675eb
commit a0f1e716c7
8 changed files with 23 additions and 5 deletions

View File

@@ -184,6 +184,7 @@ DrawIndicatorBranch=true
DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false
DrawToolBarHighlights=true
DrawToolBarBorders=false
ApplyThemePaletteGlobally=true
FlatToolBars=true
FlatSideBarIcons=true

View File

@@ -178,6 +178,7 @@ DrawIndicatorBranch=false
DrawSearchResultWidgetFrame=true
DrawTargetSelectorBottom=true
DrawToolBarHighlights=true
DrawToolBarBorders=false
ApplyThemePaletteGlobally=false
FlatToolBars=false
FlatSideBarIcons=false

View File

@@ -189,6 +189,7 @@ DrawIndicatorBranch=true
DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false
DrawToolBarHighlights=false
DrawToolBarBorders=false
ApplyThemePaletteGlobally=true
FlatToolBars=true
FlatSideBarIcons=true

View File

@@ -188,6 +188,7 @@ DrawIndicatorBranch=true
DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false
DrawToolBarHighlights=false
DrawToolBarBorders=true
ApplyThemePaletteGlobally=false
FlatToolBars=true
FlatSideBarIcons=true

View File

@@ -188,6 +188,7 @@ DrawIndicatorBranch=true
DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false
DrawToolBarHighlights=false
DrawToolBarBorders=false
ApplyThemePaletteGlobally=false
FlatToolBars=true
FlatSideBarIcons=true

View File

@@ -269,6 +269,7 @@ public:
DrawSearchResultWidgetFrame,
DrawIndicatorBranch,
DrawToolBarHighlights,
DrawToolBarBorders,
ComboBoxDrawTextShadow,
DerivePaletteFromTheme,
ApplyThemePaletteGlobally,

View File

@@ -413,9 +413,10 @@ public:
{
QWidget::paintEvent(event);
// Some Themes do not want highlights and shadows in the toolbars.
// Some Themes do not want highlights, shadows and borders in the toolbars.
// But we definitely want a separator between FancyColorButton and FancyTabBar
if (!creatorTheme()->flag(Theme::DrawToolBarHighlights)) {
if (!creatorTheme()->flag(Theme::DrawToolBarHighlights)
&& !creatorTheme()->flag(Theme::DrawToolBarBorders)) {
QPainter p(this);
p.setPen(StyleHelper::borderColor());
const QRectF innerRect = QRectF(rect()).adjusted(0.5, 0.5, -0.5, -0.5);

View File

@@ -527,20 +527,24 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
case PE_PanelStatusBar:
{
const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
painter->save();
if (creatorTheme()->flag(Theme::FlatToolBars)) {
painter->fillRect(rect, StyleHelper::baseColor());
} else {
painter->save();
QLinearGradient grad = StyleHelper::statusBarGradient(rect);
painter->fillRect(rect, grad);
const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
painter->setPen(QColor(255, 255, 255, 60));
painter->drawLine(borderRect.topLeft() + QPointF(0, 1),
borderRect.topRight()+ QPointF(0, 1));
painter->setPen(StyleHelper::borderColor().darker(110)); //TODO: make themable
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
painter->restore();
}
if (creatorTheme()->flag(Theme::DrawToolBarBorders)) {
painter->setPen(StyleHelper::borderColor());
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
}
painter->restore();
}
break;
@@ -855,6 +859,13 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
}
}
if (creatorTheme()->flag(Theme::DrawToolBarBorders)) {
painter->setPen(StyleHelper::borderColor());
if (widget && widget->property("topBorder").toBool())
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
else
painter->drawLine(borderRect.bottomLeft(), borderRect.bottomRight());
}
}
break;