]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/icon_view.cpp
Qt: draw rounded art pixmap
[vlc] / modules / gui / qt4 / components / playlist / icon_view.cpp
index 7887244fd2960a85f5f0efb29819baf0083f5fca..9266903e0997905d373c81b4991f86ad2816c56a 100644 (file)
@@ -38,7 +38,7 @@
 
 void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
 {
-    painter->setRenderHint( QPainter::Antialiasing );
+    painter->setRenderHints( QPainter::Antialiasing | QPainter::SmoothPixmapTransform );
 
     /*if( option.state & QStyle::State_Selected )
          painter->fillRect(option.rect, option.palette.highlight());*/
@@ -59,9 +59,14 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
         pix = QPixmap( ":/noart64" );
     }
 
-    QRect art_rect = option.rect.adjusted( OFFSET - 1, 0, - OFFSET, - OFFSET *2 );
+    QRect artRect = option.rect.adjusted( OFFSET - 1, 0, - OFFSET, - OFFSET *2 );
+    QPainterPath artRectPath;
+    artRectPath.addRoundedRect( artRect, 7, 7 );
 
-    painter->drawPixmap( art_rect, pix );
+    painter->drawPixmap( artRect, pix );
+    painter->setClipPath( artRectPath );
+    painter->drawPixmap( artRect, pix );
+    painter->setClipping( false );
 
     painter->setFont( QFont( "Verdana", 7 ) );