Gui: [skip ci] wheel event filter for combo boxes
This commit is contained in:
@@ -1976,6 +1976,12 @@ void Application::runApplication(void)
|
||||
if (size >= 16) // must not be lower than this
|
||||
mw.setIconSize(QSize(size,size));
|
||||
|
||||
// filter wheel events for combo boxes
|
||||
if (hGrp->GetBool("ComboBoxWheelEventFilter", false)) {
|
||||
WheelEventFilter* filter = new WheelEventFilter(&mainApp);
|
||||
mainApp.installEventFilter(filter);
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT5_OPENGL)
|
||||
{
|
||||
QWindow window;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
# include <sstream>
|
||||
# include <stdexcept>
|
||||
# include <QByteArray>
|
||||
# include <QComboBox>
|
||||
# include <QDataStream>
|
||||
# include <QDebug>
|
||||
# include <QFileInfo>
|
||||
@@ -304,4 +305,19 @@ void GUISingleApplication::processMessages()
|
||||
Q_EMIT messageReceived(msg);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WheelEventFilter::WheelEventFilter(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool WheelEventFilter::eventFilter(QObject* obj, QEvent* ev)
|
||||
{
|
||||
if (qobject_cast<QComboBox*>(obj) && ev->type() == QEvent::Wheel)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#include "moc_GuiApplication.cpp"
|
||||
|
||||
@@ -83,6 +83,15 @@ private:
|
||||
QScopedPointer<Private> d_ptr;
|
||||
};
|
||||
|
||||
class WheelEventFilter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WheelEventFilter(QObject* parent);
|
||||
bool eventFilter(QObject* obj, QEvent* ev);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // GUI_APPLICATION_H
|
||||
|
||||
Reference in New Issue
Block a user