mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Add horizontal scrolling for tracker list and torrent content
This commit is contained in:
parent
67b35b76ac
commit
b5d67f90e4
@ -41,6 +41,7 @@
|
|||||||
#include <QTreeWidgetItem>
|
#include <QTreeWidgetItem>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <QWheelEvent>
|
||||||
|
|
||||||
#include "base/bittorrent/peerinfo.h"
|
#include "base/bittorrent/peerinfo.h"
|
||||||
#include "base/bittorrent/session.h"
|
#include "base/bittorrent/session.h"
|
||||||
@ -683,3 +684,19 @@ void TrackerListWidget::displayColumnHeaderMenu()
|
|||||||
|
|
||||||
menu->popup(QCursor::pos());
|
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:
|
private:
|
||||||
int visibleColumnsCount() const;
|
int visibleColumnsCount() const;
|
||||||
|
void wheelEvent(QWheelEvent *event) override;
|
||||||
|
|
||||||
static QStringList headerLabels();
|
static QStringList headerLabels();
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QModelIndexList>
|
#include <QModelIndexList>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QWheelEvent>
|
||||||
|
|
||||||
#include "base/bittorrent/abstractfilestorage.h"
|
#include "base/bittorrent/abstractfilestorage.h"
|
||||||
#include "base/bittorrent/common.h"
|
#include "base/bittorrent/common.h"
|
||||||
@ -152,3 +153,19 @@ QModelIndex TorrentContentTreeView::currentNameCell()
|
|||||||
|
|
||||||
return model()->index(current.row(), TorrentContentModelItem::COL_NAME, current.parent());
|
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:
|
private:
|
||||||
QModelIndex currentNameCell();
|
QModelIndex currentNameCell();
|
||||||
|
void wheelEvent(QWheelEvent *event) override;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user