mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Merge pull request #6234 from Chocobo1/scroll
For each cell setting ignore wheel events. Closes #866.
This commit is contained in:
commit
7d55467f4b
@ -391,6 +391,10 @@ void AdvancedSettings::loadAdvancedSettings()
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void AdvancedSettings::addRow(int row, const QString &rowText, T* widget)
|
void AdvancedSettings::addRow(int row, const QString &rowText, T* widget)
|
||||||
{
|
{
|
||||||
|
// ignore mouse wheel event
|
||||||
|
static WheelEventEater filter;
|
||||||
|
widget->installEventFilter(&filter);
|
||||||
|
|
||||||
setItem(row, PROPERTY, new QTableWidgetItem(rowText));
|
setItem(row, PROPERTY, new QTableWidgetItem(rowText));
|
||||||
setCellWidget(row, VALUE, widget);
|
setCellWidget(row, VALUE, widget);
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#ifndef ADVANCEDSETTINGS_H
|
#ifndef ADVANCEDSETTINGS_H
|
||||||
#define ADVANCEDSETTINGS_H
|
#define ADVANCEDSETTINGS_H
|
||||||
|
|
||||||
|
#include <QEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
@ -37,6 +38,22 @@
|
|||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
|
|
||||||
|
|
||||||
|
class WheelEventEater: public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *event)
|
||||||
|
{
|
||||||
|
switch (event->type()) {
|
||||||
|
case QEvent::Wheel:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return QObject::eventFilter(obj, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class AdvancedSettings: public QTableWidget
|
class AdvancedSettings: public QTableWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Loading…
Reference in New Issue
Block a user