summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@theqtcompany.com>2016-03-02 18:25:42 +0100
committerAlessandro Portale <alessandro.portale@theqtcompany.com>2016-03-02 17:32:42 +0000
commit0f8e3f20007733e9083512157d8c8d4a1cc6ceaf (patch)
treea55b68580c44e874a793cfb504aa76290c5e99b9 /src/plugins
parenta6d43e317b35a95aa042ebfa54810175a97cfcb6 (diff)
downloadqt-creator-0f8e3f20007733e9083512157d8c8d4a1cc6ceaf.tar.gz
Flat themes: Implement Diana's separators
The flat theme as defined by Diana has the motto: "Remove unnecessary lines, avoid gradients". This patch implemets that for the flat themes, while leaving the default theme unchanged. The only tweak that touches all styles is that "Styled Separator" has for consitency now the same look as standard toolbar separators. Change-Id: I80ab0d9bf5ca20ab0daa57baf5a7e095a4a0c653 Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/coreplugin/fancyactionbar.cpp17
-rw-r--r--src/plugins/coreplugin/manhattanstyle.cpp70
2 files changed, 39 insertions, 48 deletions
diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp
index c6ffccefb6..6afe9395c6 100644
--- a/src/plugins/coreplugin/fancyactionbar.cpp
+++ b/src/plugins/coreplugin/fancyactionbar.cpp
@@ -268,22 +268,21 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
void FancyActionBar::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
-
+ const QRectF borderRect = QRectF(rect()).adjusted(0.5, 0.5, -0.5, -0.5);
if (creatorTheme()->widgetStyle () == Theme::StyleFlat) {
// this paints the background of the bottom portion of the
// left tab bar
painter.fillRect(event->rect(), StyleHelper::isBaseColorDefault()
? creatorTheme()->color(Theme::FancyTabBarBackgroundColor)
: StyleHelper::baseColor());
+ painter.setPen(StyleHelper::separatorColor());
+ painter.drawLine(borderRect.topLeft(), borderRect.topRight());
+ } else {
+ painter.setPen(StyleHelper::sidebarShadow());
+ painter.drawLine(borderRect.topLeft(), borderRect.topRight());
+ painter.setPen(StyleHelper::sidebarHighlight());
+ painter.drawLine(borderRect.topLeft() + QPointF(1, 1), borderRect.topRight() + QPointF(0, 1));
}
-
- QColor light = StyleHelper::sidebarHighlight();
- QColor dark = StyleHelper::sidebarShadow();
- const QRectF borderRect = QRectF(rect()).adjusted(0.5, 0.5, -0.5, -0.5);
- painter.setPen(dark);
- painter.drawLine(borderRect.topLeft(), borderRect.topRight());
- painter.setPen(light);
- painter.drawLine(borderRect.topLeft() + QPointF(1, 1), borderRect.topRight() + QPointF(0, 1));
}
QSize FancyToolButton::sizeHint() const
diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp
index 3c16e239d2..993a5e27d6 100644
--- a/src/plugins/coreplugin/manhattanstyle.cpp
+++ b/src/plugins/coreplugin/manhattanstyle.cpp
@@ -542,24 +542,10 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
case PE_IndicatorToolBarSeparator:
{
- QColor separatorColor = StyleHelper::borderColor();
- separatorColor.setAlpha(100);
- painter->setPen(separatorColor);
- const int margin = 6;
- if (option->state & State_Horizontal) {
- const int offset = rect.width()/2;
- painter->drawLine(rect.bottomLeft().x() + offset,
- rect.bottomLeft().y() - margin,
- rect.topLeft().x() + offset,
- rect.topLeft().y() + margin);
- } else { //Draw vertical separator
- const int offset = rect.height()/2;
- painter->setPen(QPen(option->palette.background().color().darker(110)));
- painter->drawLine(rect.topLeft().x() + margin ,
- rect.topLeft().y() + offset,
- rect.topRight().x() - margin,
- rect.topRight().y() + offset);
- }
+ QRect separatorRect = rect;
+ separatorRect.setLeft(rect.width() / 2);
+ separatorRect.setWidth(1);
+ drawButtonSeparator(painter, separatorRect, false);
}
break;
@@ -853,16 +839,17 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
// Note: This is a hack to determine if the
// toolbar should draw the top or bottom outline
// (needed for the find toolbar for instance)
- QColor lighter(StyleHelper::sidebarHighlight());
- if (drawLightColored)
- lighter = QColor(255, 255, 255, 180);
+ const QColor hightLight = creatorTheme()->widgetStyle() == Theme::StyleDefault
+ ? StyleHelper::sidebarHighlight() : StyleHelper::separatorColor();
+ const QColor borderColor = drawLightColored
+ ? QColor(255, 255, 255, 180) : hightLight;
if (widget && widget->property("topBorder").toBool()) {
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
- painter->setPen(lighter);
+ painter->setPen(borderColor);
painter->drawLine(borderRect.topLeft() + QPointF(0, 1), borderRect.topRight() + QPointF(0, 1));
} else {
painter->drawLine(borderRect.bottomLeft(), borderRect.bottomRight());
- painter->setPen(lighter);
+ painter->setPen(borderColor);
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
}
} else {
@@ -1030,20 +1017,25 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
void ManhattanStyle::drawButtonSeparator(QPainter *painter, const QRect &rect, bool reverse) const
{
const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
- QLinearGradient grad(rect.topRight(), rect.bottomRight());
- grad.setColorAt(0, QColor(255, 255, 255, 20));
- grad.setColorAt(0.4, QColor(255, 255, 255, 60));
- grad.setColorAt(0.7, QColor(255, 255, 255, 50));
- grad.setColorAt(1, QColor(255, 255, 255, 40));
- painter->setPen(QPen(grad, 1));
- painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
- grad.setColorAt(0, QColor(0, 0, 0, 30));
- grad.setColorAt(0.4, QColor(0, 0, 0, 70));
- grad.setColorAt(0.7, QColor(0, 0, 0, 70));
- grad.setColorAt(1, QColor(0, 0, 0, 40));
- painter->setPen(QPen(grad, 1));
- if (!reverse)
- painter->drawLine(borderRect.topRight() - QPointF(1, 0), borderRect.bottomRight() - QPointF(1, 0));
- else
- painter->drawLine(borderRect.topLeft(), borderRect.bottomLeft());
+ if (creatorTheme()->widgetStyle() == Theme::StyleFlat) {
+ painter->setPen(StyleHelper::separatorColor());
+ painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
+ } else {
+ QLinearGradient grad(rect.topRight(), rect.bottomRight());
+ grad.setColorAt(0, QColor(255, 255, 255, 20));
+ grad.setColorAt(0.4, QColor(255, 255, 255, 60));
+ grad.setColorAt(0.7, QColor(255, 255, 255, 50));
+ grad.setColorAt(1, QColor(255, 255, 255, 40));
+ painter->setPen(QPen(grad, 1));
+ painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
+ grad.setColorAt(0, QColor(0, 0, 0, 30));
+ grad.setColorAt(0.4, QColor(0, 0, 0, 70));
+ grad.setColorAt(0.7, QColor(0, 0, 0, 70));
+ grad.setColorAt(1, QColor(0, 0, 0, 40));
+ painter->setPen(QPen(grad, 1));
+ if (!reverse)
+ painter->drawLine(borderRect.topRight() - QPointF(1, 0), borderRect.bottomRight() - QPointF(1, 0));
+ else
+ painter->drawLine(borderRect.topLeft(), borderRect.bottomLeft());
+ }
}