+ fix focus issue with QuantitySpinBox and InputField

This commit is contained in:
wmayer 2014-07-21 18:28:46 +02:00
parent 5ba337a36d
commit b5b929cf58
2 changed files with 6 additions and 1 deletions

View File

@ -485,6 +485,8 @@ void InputField::focusInEvent(QFocusEvent * event)
if (!this->hasSelectedText())
selectNumber();
}
QLineEdit::focusInEvent(event);
}
void InputField::keyPressEvent(QKeyEvent *event)

View File

@ -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();
}
}