From 3d078c01ee14182593daed9f51aa4757de115b66 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 6 Sep 2018 14:41:55 +0200 Subject: [PATCH] [Plasma Components 3 ComboBox] Switch entries with mouse wheel --- .../plasmacomponents3/ComboBox.qml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/declarativeimports/plasmacomponents3/ComboBox.qml b/src/declarativeimports/plasmacomponents3/ComboBox.qml index b0a843023..0c5ea4035 100644 --- a/src/declarativeimports/plasmacomponents3/ComboBox.qml +++ b/src/declarativeimports/plasmacomponents3/ComboBox.qml @@ -92,6 +92,23 @@ T.ComboBox { } } } + + MouseArea { + anchors { + fill: parent + leftMargin: control.leftPadding + rightMargin: control.rightPadding + } + acceptedButtons: Qt.NoButton + onWheel: { + if (wheel.pixelDelta.y < 0 || wheel.angleDelta.y < 0) { + control.currentIndex = Math.min(control.currentIndex + 1, delegateModel.count -1); + } else { + control.currentIndex = Math.max(control.currentIndex - 1, 0); + } + control.activated(control.currentIndex); + } + } } popup: T.Popup {