mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-12-02 14:52:55 -08:00
Prevent mouse wheel scroll on entry edit username field (#12398)
* Reported by shawnkhu via Matrix, thank you!
This commit is contained in:
4 files changed
+32
-22
No files matched your search
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "autotype/AutoType.h"
|
||||
#include "core/Translator.h"
|
||||
#include "gui/GuiTools.h"
|
||||
#include "gui/Icons.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/osutils/OSUtils.h"
|
||||
@@ -66,28 +67,6 @@ private:
|
||||
QWidget* widget;
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper class to ignore mouse wheel events on non-focused widgets
|
||||
* NOTE: The widget must NOT have a focus policy of "WHEEL"
|
||||
*/
|
||||
class MouseWheelEventFilter : public QObject
|
||||
{
|
||||
public:
|
||||
explicit MouseWheelEventFilter(QObject* parent)
|
||||
: QObject(parent){};
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event) override
|
||||
{
|
||||
const auto* widget = qobject_cast<QWidget*>(obj);
|
||||
if (event->type() == QEvent::Wheel && widget && !widget->hasFocus()) {
|
||||
event->ignore();
|
||||
return true;
|
||||
}
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
};
|
||||
|
||||
ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
|
||||
: EditWidget(parent)
|
||||
, m_secWidget(new QWidget())
|
||||
|
||||
Reference in new issue
Block a user