summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-12-11 18:51:14 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-13 12:02:36 +0100
commit49a7f0b8e544fed6bf7811198d7696af8d7baba9 (patch)
treef01c68e820ac899bf111f2cf2b2a95b6eab90438 /src
parent29a362c1915f82e8eb89cf9788d2379acb67d24d (diff)
downloadqtquickcontrols-49a7f0b8e544fed6bf7811198d7696af8d7baba9.tar.gz
qtquickcontrols-49a7f0b8e544fed6bf7811198d7696af8d7baba9.tar.bz2
qtquickcontrols-49a7f0b8e544fed6bf7811198d7696af8d7baba9.zip
Make editable Combobox accept substrings
This fixes the issue that onAccepted would not update the currentText or current index if the string was a substring/partial match. Note that the new internal MatchFixedString case matches the complete string in a case insensitive way. [ChangeLog][Qt Quick Controls][Editable Combobox would not update currentText when accepting a substring of an existing value.] Task-number: QTBUG-35521 Change-Id: Ied850208425ae71b2414f1abf9389e9a8ed50cfb Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/controls/ComboBox.qml13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 81c8588d..419bc117 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -356,13 +356,10 @@ Control {
selectionColor: __style.__syspal.highlight
selectedTextColor: __style.__syspal.highlightedText
onAccepted: {
- var idx = input.find(editText)
+ var idx = input.find(editText, Qt.MatchFixedString)
if (idx > -1) {
- var string = textAt(idx);
- if (string.length === editText.length) {
- currentIndex = idx;
- editText = string;
- }
+ currentIndex = idx;
+ editText = textAt(idx);
} else {
currentIndex = -1;
popup.currentText = editText;
@@ -382,6 +379,10 @@ Control {
} else if (searchType === Qt.CaseSensitive) {
if (currentString.indexOf(text) === 0)
return i;
+ } else if (searchType === Qt.MatchFixedString) {
+ if (currentString.toLowerCase().indexOf(text.toLowerCase()) === 0
+ && currentString.length === text.length)
+ return i;
} else if (currentString.toLowerCase().indexOf(text.toLowerCase()) === 0) {
return i
}