From e89b4021ad8eaaa84a63209a0ea626a0203109af Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Thu, 17 Jan 2008 18:50:18 +0000 Subject: [PATCH] if the icons are aligned left to right, the vertical wheel event should be applied to the horizontal scrollbar BUG: 153343 svn path=/trunk/KDE/kdebase/apps/; revision=762722 --- src/dolphiniconsview.cpp | 20 ++++++++++++++++++++ src/dolphiniconsview.h | 1 + 2 files changed, 21 insertions(+) diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 553cdcfe6..21debe745 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -33,6 +33,7 @@ #include #include #include +#include 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)); diff --git a/src/dolphiniconsview.h b/src/dolphiniconsview.h index 06c417868..edc2475d4 100644 --- a/src/dolphiniconsview.h +++ b/src/dolphiniconsview.h @@ -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); -- 2.47.3