summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 d7a3d3d11..81c8588dd 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()
}