1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-11 16:44:05 +02:00

* Draw a shadow instead of a text-box on top of the GridView covers.

This commit is contained in:
Christian Muehlhaeuser
2012-11-16 15:37:36 +01:00
parent d9a6f25d61
commit 9fd4ec9efb

View File

@@ -172,11 +172,24 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
int topHeight = QFontMetrics( boldFont ).boundingRect( top ).height(); int topHeight = QFontMetrics( boldFont ).boundingRect( top ).height();
int frameHeight = bottomHeight + topHeight + 10; int frameHeight = bottomHeight + topHeight + 10;
QColor c1;
c1.setRgb( 0, 0, 0 );
c1.setAlphaF( 0.00 );
QColor c2;
c2.setRgb( 0, 0, 0 );
c2.setAlphaF( 0.99 );
QRect gradientRect = r.adjusted( 0, r.height() - frameHeight * 2, 0, 0 );
QLinearGradient gradient( QPointF( 0, 0 ), QPointF( 0, 1 ) );
gradient.setCoordinateMode( QGradient::ObjectBoundingMode );
gradient.setColorAt( 0.0, c1 );
gradient.setColorAt( 0.8, c2 );
gradient.setColorAt( 1.0, c2 );
painter->save(); painter->save();
painter->setPen( Qt::black ); painter->setPen( Qt::transparent );
painter->setBrush( Qt::black ); painter->setBrush( gradient );
painter->setOpacity( 0.5 ); painter->drawRect( gradientRect );
painter->drawRoundedRect( r.adjusted( 4, r.height() - frameHeight, -4, -4 ), 3, 3 );
painter->restore(); painter->restore();
painter->setPen( opt.palette.color( QPalette::HighlightedText ) ); painter->setPen( opt.palette.color( QPalette::HighlightedText ) );