#include <QApplication>
#include <QPainter>
#include <QPoint>
+#include <QScrollBar>
DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) :
KCategorizedView(parent),
}
}
+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));
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);