forked from qt-creator/qt-creator
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:
@@ -886,10 +886,12 @@ void LocatorWidget::acceptEntry(int row)
|
|||||||
QString newText;
|
QString newText;
|
||||||
int selectionStart = -1;
|
int selectionStart = -1;
|
||||||
int selectionLength = 0;
|
int selectionLength = 0;
|
||||||
|
QWidget *focusBeforeAccept = QApplication::focusWidget();
|
||||||
entry.filter->accept(entry, &newText, &selectionStart, &selectionLength);
|
entry.filter->accept(entry, &newText, &selectionStart, &selectionLength);
|
||||||
if (newText.isEmpty()) {
|
if (newText.isEmpty()) {
|
||||||
emit hidePopup();
|
emit hidePopup();
|
||||||
resetFocus(m_previousFocusWidget, isInMainWindow());
|
if (QApplication::focusWidget() == focusBeforeAccept)
|
||||||
|
resetFocus(m_previousFocusWidget, isInMainWindow());
|
||||||
} else {
|
} else {
|
||||||
showText(newText, selectionStart, selectionLength);
|
showText(newText, selectionStart, selectionLength);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user