mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Merge pull request #16647 from NotTsunami/hscroll
Add horizontal scrolling for tracker list and torrent content
This commit is contained in:
commit
5341478036
@ -530,9 +530,9 @@ void PeerListWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
// Shift + scroll = horizontal scroll
|
||||
event->accept();
|
||||
QWheelEvent scrollHEvent(event->position(), event->globalPosition()
|
||||
QWheelEvent scrollHEvent {event->position(), event->globalPosition()
|
||||
, event->pixelDelta(), event->angleDelta().transposed(), event->buttons()
|
||||
, event->modifiers(), event->phase(), event->inverted(), event->source());
|
||||
, event->modifiers(), event->phase(), event->inverted(), event->source()};
|
||||
QTreeView::wheelEvent(&scrollHEvent);
|
||||
return;
|
||||
}
|
||||
|
@ -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()
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ private slots:
|
||||
|
||||
private:
|
||||
int visibleColumnsCount() const;
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
|
||||
static QStringList headerLabels();
|
||||
|
||||
|
@ -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()
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -50,4 +50,5 @@ public:
|
||||
|
||||
private:
|
||||
QModelIndex currentNameCell();
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
};
|
||||
|
@ -1248,9 +1248,9 @@ void TransferListWidget::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
// Shift + scroll = horizontal scroll
|
||||
event->accept();
|
||||
QWheelEvent scrollHEvent(event->position(), event->globalPosition()
|
||||
QWheelEvent scrollHEvent {event->position(), event->globalPosition()
|
||||
, event->pixelDelta(), event->angleDelta().transposed(), event->buttons()
|
||||
, event->modifiers(), event->phase(), event->inverted(), event->source());
|
||||
, event->modifiers(), event->phase(), event->inverted(), event->source()};
|
||||
QTreeView::wheelEvent(&scrollHEvent);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user