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 24bc324..411c33a 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  );
 };