From ffad72c9ce0caa1b396dae803c97acf49835fa5f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 24 Sep 2018 14:38:30 +0200 Subject: [PATCH] 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 --- src/plugins/coreplugin/locator/locatorwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp index efddf72a736..7276685d20f 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.cpp +++ b/src/plugins/coreplugin/locator/locatorwidget.cpp @@ -886,10 +886,12 @@ 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(); - resetFocus(m_previousFocusWidget, isInMainWindow()); + if (QApplication::focusWidget() == focusBeforeAccept) + resetFocus(m_previousFocusWidget, isInMainWindow()); } else { showText(newText, selectionStart, selectionLength); }