[vlc-devel] commit: Qt: add drow shadow effect (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 15:09:25 2010 +0100| [82f5e2afcb006d254fa9c3d2296f81a6bd601d37] | committer: Jean-Baptiste Kempf 

Qt: add drow shadow effect

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

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

 modules/gui/qt4/components/playlist/icon_view.cpp |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/icon_view.cpp b/modules/gui/qt4/components/playlist/icon_view.cpp
index 2b9f52c..2169749 100644
--- a/modules/gui/qt4/components/playlist/icon_view.cpp
+++ b/modules/gui/qt4/components/playlist/icon_view.cpp
@@ -32,10 +32,11 @@
 
 #include "assert.h"
 
-#define RECT_SIZE       100
-#define ART_SIZE        64
-#define OFFSET          (100-64)/2
-#define ITEMS_SPACING   10
+#define RECT_SIZE           100
+#define ART_SIZE            64
+#define OFFSET              (100-64)/2
+#define ITEMS_SPACING       10
+#define ART_RADIUS          7
 
 void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
 {
@@ -62,8 +63,16 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
 
     QRect artRect = option.rect.adjusted( OFFSET - 1, 0, - OFFSET, - OFFSET *2 );
     QPainterPath artRectPath;
-    artRectPath.addRoundedRect( artRect, 7, 7 );
+    artRectPath.addRoundedRect( artRect, ART_RADIUS, ART_RADIUS );
 
+    // Draw the drop shadow
+    painter->save();
+    painter->setOpacity( 0.7 );
+    painter->setBrush( QBrush( Qt::gray ) );
+    painter->drawRoundedRect( artRect.adjusted( 2, 2, 2, 2 ), ART_RADIUS, ART_RADIUS );
+    painter->restore();
+
+    // Draw the art pixmap
     painter->drawPixmap( artRect, pix );
     painter->setClipPath( artRectPath );
     painter->drawPixmap( artRect, pix );




More information about the vlc-devel mailing list