]> cloud.milkyroute.net Git - dolphin.git/commitdiff
if the icons are aligned left to right, the vertical wheel event should be applied...
authorPeter Penz <peter.penz19@gmail.com>
Thu, 17 Jan 2008 18:50:18 +0000 (18:50 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 17 Jan 2008 18:50:18 +0000 (18:50 +0000)
BUG: 153343

svn path=/trunk/KDE/kdebase/apps/; revision=762722

src/dolphiniconsview.cpp
src/dolphiniconsview.h

index 553cdcfe62e8a84630aaa945a222f0f76dc1282b..21debe745e54f9fff5216c1cb93a88fec69a77c3 100644 (file)
@@ -33,6 +33,7 @@
 #include <QApplication>
 #include <QPainter>
 #include <QPoint>
+#include <QScrollBar>
 
 DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) :
     KCategorizedView(parent),
@@ -285,6 +286,25 @@ void DolphinIconsView::keyPressEvent(QKeyEvent* event)
     }
 }
 
+void DolphinIconsView::wheelEvent(QWheelEvent* event)
+{
+    KCategorizedView::wheelEvent(event);
+
+    // if the icons are aligned left to right, the vertical wheel event should
+    // be applied to the horizontal scrollbar
+    const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
+    const bool scrollHorizontal = (event->orientation() == Qt::Vertical) &&
+                                  (settings->arrangement() == QListView::LeftToRight);
+    if (scrollHorizontal) {
+        QWheelEvent horizEvent(event->pos(),
+                               event->delta(),
+                               event->buttons(),
+                               event->modifiers(),
+                               Qt::Horizontal);
+        QApplication::sendEvent(horizontalScrollBar(), &horizEvent);
+    }
+}
+
 void DolphinIconsView::triggerItem(const QModelIndex& index)
 {
     m_controller->triggerItem(itemForIndex(index));
index 06c41786822c537dac08863ad9621ae60fce5e08..edc2475d4c9f084f1f68a01f33a08b758ed3bb23 100644 (file)
@@ -62,6 +62,7 @@ protected:
     virtual void dropEvent(QDropEvent* event);
     virtual void paintEvent(QPaintEvent* event);
     virtual void keyPressEvent(QKeyEvent* event);
+    virtual void wheelEvent(QWheelEvent* event);
 
 private slots:
     void triggerItem(const QModelIndex& index);