]> git.sesse.net Git - vlc/commitdiff
A mouse click in an empty position clear the selection (see #1956)
authorLudovic Fauvet <etix@l0cal.com>
Thu, 16 Oct 2008 21:34:35 +0000 (23:34 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 16 Oct 2008 21:40:27 +0000 (23:40 +0200)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/util/customwidgets.hpp

index 24bc32436dc968d9c283411431c37e432ffc4f94..411c33aa344b4a768928c2a850dae2a0fe019a3f 100644 (file)
@@ -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  );
 };