mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-02 00:30:05 +00:00
Disable modifying settings using the scroll wheel unless they are focused
This commit is contained in:
parent
c7a19658ef
commit
e78aca7377
6 changed files with 205 additions and 39 deletions
|
|
@ -0,0 +1,23 @@
|
|||
#include <QComboBox>
|
||||
#include <QWheelEvent>
|
||||
|
||||
class QFocusedComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using QComboBox::QComboBox;
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* event) override
|
||||
{
|
||||
if (hasFocus())
|
||||
{
|
||||
QComboBox::wheelEvent(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#include <QDoubleSpinBox>
|
||||
#include <QWheelEvent>
|
||||
|
||||
class QFocusedDoubleSpinBox : public QDoubleSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using QDoubleSpinBox::QDoubleSpinBox;
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* event) override
|
||||
{
|
||||
if (hasFocus())
|
||||
{
|
||||
QDoubleSpinBox::wheelEvent(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#include <QSpinBox>
|
||||
#include <QWheelEvent>
|
||||
|
||||
class QFocusedSpinBox : public QSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using QSpinBox::QSpinBox;
|
||||
|
||||
protected:
|
||||
void wheelEvent(QWheelEvent* event) override
|
||||
{
|
||||
if (hasFocus())
|
||||
{
|
||||
QSpinBox::wheelEvent(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue