Gui: optionally disable wheel event when Gui::InputField doesn't have focus

Reuse "ComboBoxWheelEventFilter" switch that already acts on combo and spin boxes
This commit is contained in:
0penBrain
2022-10-05 16:25:27 +02:00
committed by Chris Hennes
parent 7720925e28
commit 81b67e0b67

View File

@@ -77,7 +77,12 @@ InputField::InputField(QWidget * parent)
SaveSize(5)
{
setValidator(new InputValidator(this));
setFocusPolicy(Qt::WheelFocus);
if (!App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General")->GetBool("ComboBoxWheelEventFilter",false)) {
setFocusPolicy(Qt::WheelFocus);
}
else {
setFocusPolicy(Qt::StrongFocus);
}
iconLabel = new ExpressionLabel(this);
iconLabel->setCursor(Qt::ArrowCursor);
QPixmap pixmap = getValidationIcon(":/icons/button_valid.svg", QSize(sizeHint().height(),sizeHint().height()));
@@ -699,6 +704,9 @@ void InputField::keyPressEvent(QKeyEvent *event)
void InputField::wheelEvent (QWheelEvent * event)
{
if (!hasFocus())
return;
if (isReadOnly()) {
QLineEdit::wheelEvent(event);
return;