summaryrefslogtreecommitdiff
path: root/src/controls/ComboBox.qml
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-05 18:45:53 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-05 18:45:53 +0100
commit7c5b79a92d8aa64a50f05acf21659ab136e3ca66 (patch)
treef98eba3fcd3d5418476749e676fa7429f88d075b /src/controls/ComboBox.qml
parent4746541dcfebb73ea8398e60e046e394ea9fa441 (diff)
parent4c3196c979d9a7f46b3f37b14140026dd74bf79a (diff)
downloadqtquickcontrols-7c5b79a92d8aa64a50f05acf21659ab136e3ca66.tar.gz
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I04b45f6e998fdeff87d237ec49a74f7c53b1d9f2
Diffstat (limited to 'src/controls/ComboBox.qml')
-rw-r--r--src/controls/ComboBox.qml50
1 files changed, 31 insertions, 19 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 00842a40..3b636fab 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -268,6 +268,28 @@ Control {
}
/*! \internal */
+ function __selectPrevItem() {
+ input.blockUpdate = true
+ if (currentIndex > 0) {
+ currentIndex--;
+ input.text = popup.currentText;
+ activated(currentIndex);
+ }
+ input.blockUpdate = false;
+ }
+
+ /*! \internal */
+ function __selectNextItem() {
+ input.blockUpdate = true;
+ if (currentIndex < popupItems.count - 1) {
+ currentIndex++;
+ input.text = popup.currentText;
+ activated(currentIndex);
+ }
+ input.blockUpdate = false;
+ }
+
+ /*! \internal */
property var __popup: popup
style: Qt.createComponent(Settings.style + "/ComboBoxStyle.qml", comboBox)
@@ -285,6 +307,13 @@ Control {
forceActiveFocus()
popup.show()
}
+ onWheel: {
+ if (wheel.angleDelta.y > 0) {
+ __selectPrevItem();
+ } else if (wheel.angleDelta.y < 0){
+ __selectNextItem();
+ }
+ }
}
Component.onCompleted: {
@@ -541,23 +570,6 @@ Control {
popup.show()
}
- Keys.onUpPressed: {
- input.blockUpdate = true
- if (currentIndex > 0) {
- currentIndex--;
- input.text = popup.currentText;
- activated(currentIndex);
- }
- input.blockUpdate = false;
- }
-
- Keys.onDownPressed: {
- input.blockUpdate = true;
- if (currentIndex < popupItems.count - 1) {
- currentIndex++;
- input.text = popup.currentText;
- activated(currentIndex);
- }
- input.blockUpdate = false;
- }
+ Keys.onUpPressed: __selectPrevItem()
+ Keys.onDownPressed: __selectNextItem()
}