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.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 74efb6bb..3639bf2f 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -581,9 +581,14 @@ void QQuickComboBoxPrivate::setHighlightedIndex(int index, Highlighting highligh
void QQuickComboBoxPrivate::keySearch(const QString &text)
{
- int index = match(currentIndex + 1, text, Qt::MatchStartsWith | Qt::MatchWrap);
- if (index != -1)
- setCurrentIndex(index, Activate);
+ const int startIndex = isPopupVisible() ? highlightedIndex : currentIndex;
+ const int index = match(startIndex + 1, text, Qt::MatchStartsWith | Qt::MatchWrap);
+ if (index != -1) {
+ if (isPopupVisible())
+ setHighlightedIndex(index, Highlight);
+ else
+ setCurrentIndex(index, Activate);
+ }
}
int QQuickComboBoxPrivate::match(int start, const QString &text, Qt::MatchFlags flags) const