diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2013-08-16 13:20:11 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-17 17:18:02 +0200 |
commit | 4c184095d378622fb0c3bb1692b331b3cc04e010 (patch) | |
tree | fe097a46b7e451f240a1033fbb37a7b0aace9ca6 /examples/quick/controls | |
parent | 9cde5d427a1fc1c2d36b853e1261d08f8dbfa126 (diff) | |
download | qtquickcontrols-4c184095d378622fb0c3bb1692b331b3cc04e010.tar.gz |
Make ComboBox editable
In addition
- Added text completion
- Added validator
- Added accepted signal
- Added activated signal
- Added textAt function
- Added find function
- Added keyboard indexing for non-editable as well
Note that we do not support adding values to the model,
but leave this up to the user to handle in onAccepted.
Change-Id: I1d76fa83aea0e488959c418d22ce7b6027675d86
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'examples/quick/controls')
-rw-r--r-- | examples/quick/controls/gallery/content/Controls.qml | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/examples/quick/controls/gallery/content/Controls.qml b/examples/quick/controls/gallery/content/Controls.qml index 0ad754e1..98945675 100644 --- a/examples/quick/controls/gallery/content/Controls.qml +++ b/examples/quick/controls/gallery/content/Controls.qml @@ -60,7 +60,7 @@ Item { spacing: 16 Column { id: firstColumn - spacing: 9 + spacing: 7 Row { spacing:8 Button { @@ -81,11 +81,24 @@ Item { } } ComboBox { - id: combo; - model: choices; - width: parent.width; + id: combo + model: choices + width: parent.width currentIndex: 2 } + ComboBox { + id: editableCombo + editable: true + model: choices + width: parent.width + currentIndex: 2 + onAccepted: { + if (editableCombo.find(currentText) === -1) { + choices.append({text: editText}) + currentIndex = editableCombo.find(editText) + } + } + } Row { spacing: 8 SpinBox { |