]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/util/customwidgets.hpp
A mouse click in an empty position clear the selection (see #1956)
[vlc] / 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  );
 };