diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index 2a64a610e..1c48a9645 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -485,6 +485,8 @@ void InputField::focusInEvent(QFocusEvent * event) if (!this->hasSelectedText()) selectNumber(); } + + QLineEdit::focusInEvent(event); } void InputField::keyPressEvent(QKeyEvent *event) diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index e10aec1d1..c0c4ba6b4 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -308,10 +308,13 @@ void QuantitySpinBox::showEvent(QShowEvent * event) void QuantitySpinBox::focusInEvent(QFocusEvent * event) { + bool hasSel = lineEdit()->hasSelectedText(); + QAbstractSpinBox::focusInEvent(event); + if (event->reason() == Qt::TabFocusReason || event->reason() == Qt::BacktabFocusReason || event->reason() == Qt::ShortcutFocusReason) { - if (!lineEdit()->hasSelectedText()) + if (!hasSel) selectNumber(); } }