Fix fix for focus handling when leaving locator

If accepting a filter entry already changes the focus, then we should
not interfere by setting it somewhere else again.

Task-number: QTCREATORBUG-21125
Change-Id: I9ff76b0bae9280b44c73d7078f25ca42b6b89821
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Eike Ziller
2018-09-24 14:38:30 +02:00
parent 9da9ed45e9
commit ffad72c9ce

View File

@@ -886,9 +886,11 @@ void LocatorWidget::acceptEntry(int row)
QString newText;
int selectionStart = -1;
int selectionLength = 0;
QWidget *focusBeforeAccept = QApplication::focusWidget();
entry.filter->accept(entry, &newText, &selectionStart, &selectionLength);
if (newText.isEmpty()) {
emit hidePopup();
if (QApplication::focusWidget() == focusBeforeAccept)
resetFocus(m_previousFocusWidget, isInMainWindow());
} else {
showText(newText, selectionStart, selectionLength);