+ fix focus issue with QuantitySpinBox and InputField

This commit is contained in:
wmayer
2014-07-21 18:28:46 +02:00
parent f83e5812af
commit c504fc56b3
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();
}
}