Browse Source

Merge pull request #5981 from Chocobo1/scroll_h

Horizontal scroll
adaptive-webui-19844
sledgehammer999 8 years ago committed by GitHub
parent
commit
3c1774360f
  1. 14
      src/gui/properties/peerlistwidget.cpp
  2. 2
      src/gui/properties/peerlistwidget.h
  3. 15
      src/gui/transferlistwidget.cpp
  4. 2
      src/gui/transferlistwidget.h

14
src/gui/properties/peerlistwidget.cpp

@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
#include <QMenu>
#include <QClipboard>
#include <QMessageBox>
#include <QWheelEvent>
#ifdef QBT_USES_QT5
#include <QTableView>
#endif
@ -455,3 +456,16 @@ void PeerListWidget::handleSortColumnChanged(int col) @@ -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
}

2
src/gui/properties/peerlistwidget.h

@ -85,6 +85,8 @@ private slots: @@ -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;

15
src/gui/transferlistwidget.cpp

@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
#include <QRegExp>
#include <QFileDialog>
#include <QMessageBox>
#include <QWheelEvent>
#ifdef QBT_USES_QT5
#include <QTableView>
#endif
@ -933,6 +934,20 @@ bool TransferListWidget::loadSettings() @@ -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<BitTorrent::TorrentHandle *> &torrents)
{
QStringList hashes;

2
src/gui/transferlistwidget.h

@ -115,6 +115,8 @@ signals: @@ -115,6 +115,8 @@ signals:
void currentTorrentChanged(BitTorrent::TorrentHandle *const torrent);
private:
void wheelEvent(QWheelEvent *event) override;
TransferListDelegate *listDelegate;
TorrentModel *listModel;
TransferListSortModel *nameFilterModel;

Loading…
Cancel
Save