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
|
DrawSearchResultWidgetFrame=false
|
||||||
DrawTargetSelectorBottom=false
|
DrawTargetSelectorBottom=false
|
||||||
DrawToolBarHighlights=true
|
DrawToolBarHighlights=true
|
||||||
|
DrawToolBarBorders=false
|
||||||
ApplyThemePaletteGlobally=true
|
ApplyThemePaletteGlobally=true
|
||||||
FlatToolBars=true
|
FlatToolBars=true
|
||||||
FlatSideBarIcons=true
|
FlatSideBarIcons=true
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ DrawIndicatorBranch=false
|
|||||||
DrawSearchResultWidgetFrame=true
|
DrawSearchResultWidgetFrame=true
|
||||||
DrawTargetSelectorBottom=true
|
DrawTargetSelectorBottom=true
|
||||||
DrawToolBarHighlights=true
|
DrawToolBarHighlights=true
|
||||||
|
DrawToolBarBorders=false
|
||||||
ApplyThemePaletteGlobally=false
|
ApplyThemePaletteGlobally=false
|
||||||
FlatToolBars=false
|
FlatToolBars=false
|
||||||
FlatSideBarIcons=false
|
FlatSideBarIcons=false
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ DrawIndicatorBranch=true
|
|||||||
DrawSearchResultWidgetFrame=false
|
DrawSearchResultWidgetFrame=false
|
||||||
DrawTargetSelectorBottom=false
|
DrawTargetSelectorBottom=false
|
||||||
DrawToolBarHighlights=false
|
DrawToolBarHighlights=false
|
||||||
|
DrawToolBarBorders=false
|
||||||
ApplyThemePaletteGlobally=true
|
ApplyThemePaletteGlobally=true
|
||||||
FlatToolBars=true
|
FlatToolBars=true
|
||||||
FlatSideBarIcons=true
|
FlatSideBarIcons=true
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ DrawIndicatorBranch=true
|
|||||||
DrawSearchResultWidgetFrame=false
|
DrawSearchResultWidgetFrame=false
|
||||||
DrawTargetSelectorBottom=false
|
DrawTargetSelectorBottom=false
|
||||||
DrawToolBarHighlights=false
|
DrawToolBarHighlights=false
|
||||||
|
DrawToolBarBorders=true
|
||||||
ApplyThemePaletteGlobally=false
|
ApplyThemePaletteGlobally=false
|
||||||
FlatToolBars=true
|
FlatToolBars=true
|
||||||
FlatSideBarIcons=true
|
FlatSideBarIcons=true
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ DrawIndicatorBranch=true
|
|||||||
DrawSearchResultWidgetFrame=false
|
DrawSearchResultWidgetFrame=false
|
||||||
DrawTargetSelectorBottom=false
|
DrawTargetSelectorBottom=false
|
||||||
DrawToolBarHighlights=false
|
DrawToolBarHighlights=false
|
||||||
|
DrawToolBarBorders=false
|
||||||
ApplyThemePaletteGlobally=false
|
ApplyThemePaletteGlobally=false
|
||||||
FlatToolBars=true
|
FlatToolBars=true
|
||||||
FlatSideBarIcons=true
|
FlatSideBarIcons=true
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ public:
|
|||||||
DrawSearchResultWidgetFrame,
|
DrawSearchResultWidgetFrame,
|
||||||
DrawIndicatorBranch,
|
DrawIndicatorBranch,
|
||||||
DrawToolBarHighlights,
|
DrawToolBarHighlights,
|
||||||
|
DrawToolBarBorders,
|
||||||
ComboBoxDrawTextShadow,
|
ComboBoxDrawTextShadow,
|
||||||
DerivePaletteFromTheme,
|
DerivePaletteFromTheme,
|
||||||
ApplyThemePaletteGlobally,
|
ApplyThemePaletteGlobally,
|
||||||
|
|||||||
@@ -413,9 +413,10 @@ public:
|
|||||||
{
|
{
|
||||||
QWidget::paintEvent(event);
|
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
|
// 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);
|
QPainter p(this);
|
||||||
p.setPen(StyleHelper::borderColor());
|
p.setPen(StyleHelper::borderColor());
|
||||||
const QRectF innerRect = QRectF(rect()).adjusted(0.5, 0.5, -0.5, -0.5);
|
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:
|
case PE_PanelStatusBar:
|
||||||
{
|
{
|
||||||
|
const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
|
||||||
|
painter->save();
|
||||||
if (creatorTheme()->flag(Theme::FlatToolBars)) {
|
if (creatorTheme()->flag(Theme::FlatToolBars)) {
|
||||||
painter->fillRect(rect, StyleHelper::baseColor());
|
painter->fillRect(rect, StyleHelper::baseColor());
|
||||||
} else {
|
} else {
|
||||||
painter->save();
|
|
||||||
QLinearGradient grad = StyleHelper::statusBarGradient(rect);
|
QLinearGradient grad = StyleHelper::statusBarGradient(rect);
|
||||||
painter->fillRect(rect, grad);
|
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->setPen(QColor(255, 255, 255, 60));
|
||||||
painter->drawLine(borderRect.topLeft() + QPointF(0, 1),
|
painter->drawLine(borderRect.topLeft() + QPointF(0, 1),
|
||||||
borderRect.topRight()+ QPointF(0, 1));
|
borderRect.topRight()+ QPointF(0, 1));
|
||||||
painter->setPen(StyleHelper::borderColor().darker(110)); //TODO: make themable
|
painter->setPen(StyleHelper::borderColor().darker(110)); //TODO: make themable
|
||||||
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
|
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;
|
break;
|
||||||
|
|
||||||
@@ -855,6 +859,13 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
|
|||||||
painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
|
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;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user