[vlc-devel] commit: Qt: draw rounded art pixmap (Ludovic Fauvet )

git version control git at videolan.org
Mon Jan 25 16:08:33 CET 2010


vlc | branch: master | Ludovic Fauvet <etix at l0cal.com> | Mon Jan 25 14:00:37 2010 +0100| [af9bd10dd5643470256a3f4c0543225c818d6a27] | committer: Jean-Baptiste Kempf 

Qt: draw rounded art pixmap

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af9bd10dd5643470256a3f4c0543225c818d6a27
---

 modules/gui/qt4/components/playlist/icon_view.cpp |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/icon_view.cpp b/modules/gui/qt4/components/playlist/icon_view.cpp
index 7887244..9266903 100644
--- a/modules/gui/qt4/components/playlist/icon_view.cpp
+++ b/modules/gui/qt4/components/playlist/icon_view.cpp
@@ -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 ) );
 




More information about the vlc-devel mailing list