aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickcombobox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquickcombobox.cpp')
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 86150a0f..7833b39b 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -1730,6 +1730,12 @@ bool QQuickComboBox::eventFilter(QObject *object, QEvent *event)
// the user clicked on the popup button to open it, not close it).
d->hidePopup(false);
setPressed(false);
+
+ // The focus left the text field, so if the edit text matches an item in the model,
+ // change our currentIndex to that. This matches widgets' behavior.
+ const int indexForEditText = find(d->extra.value().editText, Qt::MatchFixedString);
+ if (indexForEditText > -1)
+ setCurrentIndex(indexForEditText);
}
break;
#if QT_CONFIG(im)