From 3f5789d0cbd1ca52422bd26ebf1e805e83ea0cf7 Mon Sep 17 00:00:00 2001 From: lasconic Date: Sun, 13 Jul 2014 20:31:09 +0200 Subject: [PATCH] add bottom line to groupbox, start to fix spinbox style in plugins --- mstyle/mstyle.cpp | 7 +++---- mstyle/stylehelper.cpp | 18 +++++++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/mstyle/mstyle.cpp b/mstyle/mstyle.cpp index 22723f8668443..d78d095bfdef8 100644 --- a/mstyle/mstyle.cpp +++ b/mstyle/mstyle.cpp @@ -1268,7 +1268,8 @@ bool MgStyle::drawFrameGroupBoxPrimitive(const QStyleOption* option, QPainter* p painter->setRenderHint(QPainter::Antialiasing); painter->setPen(Qt::NoPen); - QLinearGradient innerGradient(0, r.top() - r.height() + 12, 0, r.bottom() + r.height() - 19); + //lasconic : no gradient + /*QLinearGradient innerGradient(0, r.top() - r.height() + 12, 0, r.bottom() + r.height() - 19); QColor light(_helper.calcLightColor(base)); light.setAlphaF(0.4); innerGradient.setColorAt(0.0, light); @@ -1276,7 +1277,7 @@ bool MgStyle::drawFrameGroupBoxPrimitive(const QStyleOption* option, QPainter* p innerGradient.setColorAt(1.0, light); painter->setBrush(innerGradient); painter->setClipRect(r.adjusted(0, 0, 0, -19)); - _helper.fillSlab(*painter, r); + _helper.fillSlab(*painter, r);*/ TileSet* slopeTileSet = _helper.slope(base, 0.0); painter->setClipping(false); @@ -8010,8 +8011,6 @@ QRect MgStyle::subElementRect(SubElement element, const QStyleOption* option, co //--------------------------------------------------------- QRect MgStyle::subControlRect(ComplexControl element, const QStyleOptionComplex* option, SubControl subControl, const QWidget* widget ) const { - if (!widget) - return QRect(); switch (element) { case CC_GroupBox: return groupBoxSubControlRect( option, subControl, widget ); diff --git a/mstyle/stylehelper.cpp b/mstyle/stylehelper.cpp index 1f3d60dfb5e1a..488dcb457b280 100644 --- a/mstyle/stylehelper.cpp +++ b/mstyle/stylehelper.cpp @@ -1525,15 +1525,19 @@ TileSet* StyleHelper::slope(const QColor& color, qreal shade, int size) const { QPainter p(&image); p.setPen(Qt::NoPen); + //lasconic: add bottom, remove gradient // edges TileSet* slabTileSet = slab(color, shade, size); - slabTileSet->render(QRect(0, 0, size * 4, size * 5), &p, - TileSet::Left | TileSet::Right | TileSet::Top); + slabTileSet->render(QRect(0, 0, size * 4, size * 4), &p, + TileSet::Left | TileSet::Right | TileSet::Top | TileSet::Bottom); + + //slabTileSet->render(QRect(0, 0, size * 4, size * 5), &p, + // TileSet::Left | TileSet::Right | TileSet::Top); - p.setWindow(0, 0, 28, 28); + //p.setWindow(0, 0, 28, 28); // bottom - QColor light = ColorUtils::shade(calcLightColor(color), shade); + /*QColor light = ColorUtils::shade(calcLightColor(color), shade); QLinearGradient fillGradient(0, -28, 0, 28); light.setAlphaF(0.4); fillGradient.setColorAt(0.0, light); @@ -1541,17 +1545,17 @@ TileSet* StyleHelper::slope(const QColor& color, qreal shade, int size) const { fillGradient.setColorAt(1.0, light); p.setBrush(fillGradient); p.setCompositionMode(QPainter::CompositionMode_DestinationOver); - p.drawRect(3, 9, 22, 17); + p.drawRect(3, 9, 22, 17);*/ // fade bottom - QLinearGradient maskGradient(0, 7, 0, 28); + /*QLinearGradient maskGradient(0, 7, 0, 28); maskGradient.setColorAt(0.0, Qt::black); maskGradient.setColorAt(1.0, Qt::transparent); p.setBrush(maskGradient); p.setCompositionMode(QPainter::CompositionMode_DestinationIn); p.drawRect(0, 9, 28, 19); - p.end(); + p.end();*/ tileSet = new TileSet(QPixmap::fromImage(image), size, size, size * 2, 2); m_slopeCache.insert(key, tileSet);