[vlc-devel] [PATCH] A mouse click in an empty position clear the selection (see #1956)

Ludovic Fauvet etix at l0cal.com
Thu Oct 16 23:34:35 CEST 2008


---
 modules/gui/qt4/util/customwidgets.hpp |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/util/customwidgets.hpp b/modules/gui/qt4/util/customwidgets.hpp
index 24bc324..411c33a 100644
--- a/modules/gui/qt4/util/customwidgets.hpp
+++ b/modules/gui/qt4/util/customwidgets.hpp
@@ -75,7 +75,7 @@ public:
     };
     virtual ~QVLCTreeView()   {};
 
-    void mouseReleaseEvent(QMouseEvent* e )
+    void mouseReleaseEvent( QMouseEvent* e )
     {
         if( e->button() & Qt::RightButton )
         {
@@ -84,6 +84,16 @@ public:
         }
         QTreeView::mouseReleaseEvent( e );
     }
+
+    void mousePressEvent( QMouseEvent* e )
+    {
+        if( e->button() & Qt::LeftButton )
+        {
+            if( !indexAt( QPoint( e->x(), e->y() ) ).isValid() )
+                clearSelection();
+        }
+        QTreeView::mousePressEvent( e );
+    }
 signals:
     void rightClicked( QModelIndex, QPoint  );
 };
-- 
1.5.6.4




More information about the vlc-devel mailing list