From 256ec29cf0ccafee497ed161449ccfe7178e0b11 Mon Sep 17 00:00:00 2001 From: Ludovic Fauvet Date: Thu, 16 Oct 2008 23:34:35 +0200 Subject: [PATCH] A mouse click in an empty position clear the selection (see #1956) Signed-off-by: Jean-Baptiste Kempf --- modules/gui/qt4/util/customwidgets.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/gui/qt4/util/customwidgets.hpp b/modules/gui/qt4/util/customwidgets.hpp index 24bc32436d..411c33aa34 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 ); }; -- 2.39.2