+ fix focus issue with QuantitySpinBox and InputField
This commit is contained in:
parent
5ba337a36d
commit
b5b929cf58
|
@ -485,6 +485,8 @@ void InputField::focusInEvent(QFocusEvent * event)
|
|||
if (!this->hasSelectedText())
|
||||
selectNumber();
|
||||
}
|
||||
|
||||
QLineEdit::focusInEvent(event);
|
||||
}
|
||||
|
||||
void InputField::keyPressEvent(QKeyEvent *event)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user