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

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


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

Qt: correctly handle mousewheel in selector

Close #6812

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

 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