- QPainterPath artRectPath;
- artRectPath.addRoundedRect( artRect, ART_RADIUS, ART_RADIUS );
+ // picture where all the rendering happens and which will be cached
+ QPixmap pix;
+
+ QString key = title + artist + artUrl;
+ if(QPixmapCache::find( key, pix ))
+ {
+ // cool, we found it in the cache
+ painter->drawPixmap( option.rect, pix );
+ return;
+ }
+
+ // load album art
+ QPixmap artPix;
+ if( artUrl.isEmpty() || !artPix.load( artUrl ) )
+ artPix = QPixmap( ":/noart64" );
+ else
+ artPix = artPix.scaled( ART_SIZE, ART_SIZE,
+ Qt::KeepAspectRatioByExpanding );
+
+ pix = QPixmap( RECT_SIZE, RECT_SIZE );
+ pix.fill( Qt::transparent );
+
+ QPainter *pixpainter = new QPainter( &pix );
+
+ pixpainter->setRenderHints(
+ QPainter::Antialiasing | QPainter::SmoothPixmapTransform );