[vlc-commits] Qt: correctly handle mousewheel in selector

Jean-Baptiste Kempf git at videolan.org
Tue May 15 16:20:12 CEST 2012


vlc/vlc-2.0 | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue May 15 16:15:16 2012 +0200| [e881d32041b4e51d6015af01ab45537e6398801d] | committer: Jean-Baptiste Kempf

Qt: correctly handle mousewheel in selector

Close #6812
(cherry picked from commit 16c1b2916cf36a8e9c218ab856a62f289f6d2d80)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=e881d32041b4e51d6015af01ab45537e6398801d
---

 modules/gui/qt4/components/playlist/selector.cpp |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/selector.cpp b/modules/gui/qt4/components/playlist/selector.cpp
index 114cc37..3bce22c 100644
--- a/modules/gui/qt4/components/playlist/selector.cpp
+++ b/modules/gui/qt4/components/playlist/selector.cpp
@@ -31,6 +31,7 @@
 #include "playlist_model.hpp"                /* plMimeData */
 #include "input_manager.hpp"                 /* MainInputManager, for podcast */
 
+#include <QApplication>
 #include <QInputDialog>
 #include <QMessageBox>
 #include <QMimeData>
@@ -39,6 +40,7 @@
 #include <QHBoxLayout>
 #include <QPainter>
 #include <QPalette>
+#include <QScrollBar>
 
 #include <vlc_playlist.h>
 #include <vlc_services_discovery.h>
@@ -550,6 +552,12 @@ int PLSelector::getCurrentItemCategory()
 
 void PLSelector::wheelEvent( QWheelEvent *e )
 {
+    if( verticalScrollBar()->isVisible() && (
+        (verticalScrollBar()->value() != verticalScrollBar()->minimum() && e->delta() >= 0 ) ||
+        (verticalScrollBar()->value() != verticalScrollBar()->maximum() && e->delta() < 0 )
+        ) )
+        QApplication::sendEvent(verticalScrollBar(), e);
+
     // Accept this event in order to prevent unwanted volume up/down changes
     e->accept();
 }



More information about the vlc-commits mailing list