diff --git a/src/gui/properties/peerlistwidget.cpp b/src/gui/properties/peerlistwidget.cpp index 1189a1a95..258fc553e 100644 --- a/src/gui/properties/peerlistwidget.cpp +++ b/src/gui/properties/peerlistwidget.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #ifdef QBT_USES_QT5 #include #endif @@ -455,3 +456,16 @@ void PeerListWidget::handleSortColumnChanged(int col) } } +void PeerListWidget::wheelEvent(QWheelEvent *event) +{ + event->accept(); + + if(event->modifiers() & Qt::ShiftModifier) { + // Shift + scroll = horizontal scroll + QWheelEvent scrollHEvent(event->pos(), event->globalPos(), event->delta(), event->buttons(), event->modifiers(), Qt::Horizontal); + QTreeView::wheelEvent(&scrollHEvent); + return; + } + + QTreeView::wheelEvent(event); // event delegated to base class +} diff --git a/src/gui/properties/peerlistwidget.h b/src/gui/properties/peerlistwidget.h index 7b4ca50ef..6a6de5abb 100644 --- a/src/gui/properties/peerlistwidget.h +++ b/src/gui/properties/peerlistwidget.h @@ -85,6 +85,8 @@ private slots: void handleResolved(const QString &ip, const QString &hostname); private: + void wheelEvent(QWheelEvent *event) override; + QStandardItemModel *m_listModel; PeerListDelegate *m_listDelegate; PeerListSortModel *m_proxyModel; diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index b8ba5798c..ae193f55c 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #ifdef QBT_USES_QT5 #include #endif @@ -933,6 +934,20 @@ bool TransferListWidget::loadSettings() return ok; } +void TransferListWidget::wheelEvent(QWheelEvent *event) +{ + event->accept(); + + if(event->modifiers() & Qt::ShiftModifier) { + // Shift + scroll = horizontal scroll + QWheelEvent scrollHEvent(event->pos(), event->globalPos(), event->delta(), event->buttons(), event->modifiers(), Qt::Horizontal); + QTreeView::wheelEvent(&scrollHEvent); + return; + } + + QTreeView::wheelEvent(event); // event delegated to base class +} + QStringList extractHashes(const QList &torrents) { QStringList hashes; diff --git a/src/gui/transferlistwidget.h b/src/gui/transferlistwidget.h index 46ec1c371..18b300f3f 100644 --- a/src/gui/transferlistwidget.h +++ b/src/gui/transferlistwidget.h @@ -115,6 +115,8 @@ signals: void currentTorrentChanged(BitTorrent::TorrentHandle *const torrent); private: + void wheelEvent(QWheelEvent *event) override; + TransferListDelegate *listDelegate; TorrentModel *listModel; TransferListSortModel *nameFilterModel;