summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2014-01-08 12:39:41 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-08 13:57:39 +0100
commit7306cfd789274ef5f53e964a63d92b60352bd853 (patch)
tree24b174721b02cae939d2c6a6005561c7ad2ab28c
parent8dc2cda27b9d0bf5d732c3f6de253f4989e198c4 (diff)
downloadqtquickcontrols-7306cfd789274ef5f53e964a63d92b60352bd853.tar.gz
ComboBox: Don't suggest auto-complete text if editText is empty
... for editable ComboBoxes, that is. Change-Id: Ieda089f715e8252ae47bbbff647982f96ec5f797 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
-rw-r--r--src/controls/ComboBox.qml2
-rw-r--r--tests/auto/controls/data/tst_combobox.qml1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 419bc117..974af0ae 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -425,7 +425,7 @@ Control {
Keys.onPressed: allowComplete = (event.key !== Qt.Key_Backspace && event.key !== Qt.Key_Delete);
onTextChanged: {
- if (editable && !blockUpdate && allowComplete) {
+ if (editable && !blockUpdate && allowComplete && text.length > 0) {
var completed = input.tryComplete(text)
if (completed.length > text.length) {
var oldtext = input.text;
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index f63a6ee7..fde8444c 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -267,6 +267,7 @@ TestCase {
compare(comboBox.acceptedCount, 3)
comboBox.editText = ""
+ compare(comboBox.editText, "")
keyPress(Qt.Key_A)
compare(comboBox.currentText, "Cocomuffin")