Skip to content

Commit

Permalink
add bottom line to groupbox, start to fix spinbox style in plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Jul 13, 2014
1 parent 739cb9c commit 3f5789d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
7 changes: 3 additions & 4 deletions mstyle/mstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,15 +1268,16 @@ 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);
light.setAlphaF(0.0);
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);
Expand Down Expand Up @@ -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 );
Expand Down
18 changes: 11 additions & 7 deletions mstyle/stylehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1525,33 +1525,37 @@ 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);
light.setAlphaF(0.0);
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);
Expand Down

0 comments on commit 3f5789d

Please sign in to comment.