From b5b929cf5822dad2b6622ab7593a112dd2c6b8f4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 21 Jul 2014 18:28:46 +0200 Subject: [PATCH] + fix focus issue with QuantitySpinBox and InputField --- src/Gui/InputField.cpp | 2 ++ src/Gui/QuantitySpinBox.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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(); } }