forked from qt-creator/qt-creator
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:
@@ -184,6 +184,7 @@ DrawIndicatorBranch=true
|
||||
DrawSearchResultWidgetFrame=false
|
||||
DrawTargetSelectorBottom=false
|
||||
DrawToolBarHighlights=true
|
||||
DrawToolBarBorders=false
|
||||
ApplyThemePaletteGlobally=true
|
||||
FlatToolBars=true
|
||||
FlatSideBarIcons=true
|
||||
|
||||
@@ -178,6 +178,7 @@ DrawIndicatorBranch=false
|
||||
DrawSearchResultWidgetFrame=true
|
||||
DrawTargetSelectorBottom=true
|
||||
DrawToolBarHighlights=true
|
||||
DrawToolBarBorders=false
|
||||
ApplyThemePaletteGlobally=false
|
||||
FlatToolBars=false
|
||||
FlatSideBarIcons=false
|
||||
|
||||
@@ -189,6 +189,7 @@ DrawIndicatorBranch=true
|
||||
DrawSearchResultWidgetFrame=false
|
||||
DrawTargetSelectorBottom=false
|
||||
DrawToolBarHighlights=false
|
||||
DrawToolBarBorders=false
|
||||
ApplyThemePaletteGlobally=true
|
||||
FlatToolBars=true
|
||||
FlatSideBarIcons=true
|
||||
|
||||
@@ -188,6 +188,7 @@ DrawIndicatorBranch=true
|
||||
DrawSearchResultWidgetFrame=false
|
||||
DrawTargetSelectorBottom=false
|
||||
DrawToolBarHighlights=false
|
||||
DrawToolBarBorders=true
|
||||
ApplyThemePaletteGlobally=false
|
||||
FlatToolBars=true
|
||||
FlatSideBarIcons=true
|
||||
|
||||
@@ -188,6 +188,7 @@ DrawIndicatorBranch=true
|
||||
DrawSearchResultWidgetFrame=false
|
||||
DrawTargetSelectorBottom=false
|
||||
DrawToolBarHighlights=false
|
||||
DrawToolBarBorders=false
|
||||
ApplyThemePaletteGlobally=false
|
||||
FlatToolBars=true
|
||||
FlatSideBarIcons=true
|
||||
|
||||
@@ -269,6 +269,7 @@ public:
|
||||
DrawSearchResultWidgetFrame,
|
||||
DrawIndicatorBranch,
|
||||
DrawToolBarHighlights,
|
||||
DrawToolBarBorders,
|
||||
ComboBoxDrawTextShadow,
|
||||
DerivePaletteFromTheme,
|
||||
ApplyThemePaletteGlobally,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user