Browse Source

Add horizontal scrolling for tracker list and torrent content

adaptive-webui-19844
NotTsunami 3 years ago
parent
commit
b5d67f90e4
  1. 17
      src/gui/properties/trackerlistwidget.cpp
  2. 1
      src/gui/properties/trackerlistwidget.h
  3. 17
      src/gui/torrentcontenttreeview.cpp
  4. 1
      src/gui/torrentcontenttreeview.h

17
src/gui/properties/trackerlistwidget.cpp

@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
#include <QTreeWidgetItem>
#include <QUrl>
#include <QVector>
#include <QWheelEvent>
#include "base/bittorrent/peerinfo.h"
#include "base/bittorrent/session.h"
@ -683,3 +684,19 @@ void TrackerListWidget::displayColumnHeaderMenu() @@ -683,3 +684,19 @@ void TrackerListWidget::displayColumnHeaderMenu()
menu->popup(QCursor::pos());
}
void TrackerListWidget::wheelEvent(QWheelEvent *event)
{
if (event->modifiers() & Qt::ShiftModifier)
{
// Shift + scroll = horizontal scroll
event->accept();
QWheelEvent scrollHEvent {event->position(), event->globalPosition()
, event->pixelDelta(), event->angleDelta().transposed(), event->buttons()
, event->modifiers(), event->phase(), event->inverted(), event->source()};
QTreeView::wheelEvent(&scrollHEvent);
return;
}
QTreeView::wheelEvent(event); // event delegated to base class
}

1
src/gui/properties/trackerlistwidget.h

@ -87,6 +87,7 @@ private slots: @@ -87,6 +87,7 @@ private slots:
private:
int visibleColumnsCount() const;
void wheelEvent(QWheelEvent *event) override;
static QStringList headerLabels();

17
src/gui/torrentcontenttreeview.cpp

@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
#include <QMessageBox>
#include <QModelIndexList>
#include <QThread>
#include <QWheelEvent>
#include "base/bittorrent/abstractfilestorage.h"
#include "base/bittorrent/common.h"
@ -152,3 +153,19 @@ QModelIndex TorrentContentTreeView::currentNameCell() @@ -152,3 +153,19 @@ QModelIndex TorrentContentTreeView::currentNameCell()
return model()->index(current.row(), TorrentContentModelItem::COL_NAME, current.parent());
}
void TorrentContentTreeView::wheelEvent(QWheelEvent *event)
{
if (event->modifiers() & Qt::ShiftModifier)
{
// Shift + scroll = horizontal scroll
event->accept();
QWheelEvent scrollHEvent {event->position(), event->globalPosition()
, event->pixelDelta(), event->angleDelta().transposed(), event->buttons()
, event->modifiers(), event->phase(), event->inverted(), event->source()};
QTreeView::wheelEvent(&scrollHEvent);
return;
}
QTreeView::wheelEvent(event); // event delegated to base class
}

1
src/gui/torrentcontenttreeview.h

@ -50,4 +50,5 @@ public: @@ -50,4 +50,5 @@ public:
private:
QModelIndex currentNameCell();
void wheelEvent(QWheelEvent *event) override;
};

Loading…
Cancel
Save