Move status bar gradient to helper function.

Change-Id: I803f354f1efb0f3c79e7e9ee61fb50d3d5f71363
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
This commit is contained in:
Eike Ziller
2013-03-22 14:06:42 +01:00
parent e9356c28c2
commit 92f65afeb8
3 changed files with 12 additions and 6 deletions

View File

@@ -496,5 +496,14 @@ void StyleHelper::tintImage(QImage &img, const QColor &tintColor)
} }
} }
QLinearGradient StyleHelper::statusBarGradient(const QRect &statusBarRect)
{
QLinearGradient grad(statusBarRect.topLeft(), QPoint(statusBarRect.center().x(), statusBarRect.bottom()));
QColor startColor = shadowColor().darker(164);
QColor endColor = baseColor().darker(130);
grad.setColorAt(0, startColor);
grad.setColorAt(1, endColor);
return grad;
}
} // namespace Utils } // namespace Utils

View File

@@ -88,6 +88,7 @@ public:
int left = 0, int top = 0, int right = 0, int bottom = 0); int left = 0, int top = 0, int right = 0, int bottom = 0);
static void tintImage(QImage &img, const QColor &tintColor); static void tintImage(QImage &img, const QColor &tintColor);
static QLinearGradient statusBarGradient(const QRect &statusBarRect);
private: private:
static QColor m_baseColor; static QColor m_baseColor;

View File

@@ -518,12 +518,8 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
case PE_PanelStatusBar: case PE_PanelStatusBar:
{ {
painter->save(); painter->save();
QLinearGradient grad(option->rect.topLeft(), QPoint(rect.center().x(), rect.bottom())); QLinearGradient grad = Utils::StyleHelper::statusBarGradient(rect);
QColor startColor = Utils::StyleHelper::shadowColor().darker(164); painter->fillRect(rect, grad);
QColor endColor = Utils::StyleHelper::baseColor().darker(130);
grad.setColorAt(0, startColor);
grad.setColorAt(1, endColor);
painter->fillRect(option->rect, grad);
painter->setPen(QColor(255, 255, 255, 60)); painter->setPen(QColor(255, 255, 255, 60));
painter->drawLine(rect.topLeft() + QPoint(0,1), painter->drawLine(rect.topLeft() + QPoint(0,1),
rect.topRight()+ QPoint(0,1)); rect.topRight()+ QPoint(0,1));