summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Erb <erb@suitabletech.com>2017-03-02 21:15:56 -0500
committerJason Erb (Suitable Technologies) <erb@suitabletech.com>2017-03-06 19:05:29 +0000
commit9a56985c91d16d7c42ba86f4b0a70f85973e0618 (patch)
tree4385c2ae0b2f8e73fdd8a2d6cc9f6fc7edd2f477
parent43d417b127215f53cb01ac14a558fec705fbf4ad (diff)
downloadqtquickcontrols-9a56985c91d16d7c42ba86f4b0a70f85973e0618.tar.gz
Slider: add property to disable scroll wheel
Add a property to disable the scroll wheel for the Slider. This is useful if there is a scrollable list of sliders, because scrolling would be interrupted as soon as the mouse gets above a slider (whereby scrolling would change the slider value). By setting this property to false, a user can easily scroll through the list. [ChangeLog][Slider] add property to disable scroll wheel Task-number: QTBUG-59271 Change-Id: I9306638ef98f8a0a5035709a67cc1ee40713441a Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--src/controls/Slider.qml10
-rw-r--r--src/controls/plugin.cpp4
-rw-r--r--tests/auto/controls/data/tst_slider.qml9
3 files changed, 21 insertions, 2 deletions
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index 4023929a..d55e81a3 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -171,6 +171,16 @@ Control {
*/
property bool tickmarksEnabled: false
+ /*!
+ \qmlproperty bool Slider::wheelEnabled
+
+ This property determines whether the control handles wheel events.
+ The default value is \c true.
+
+ \since QtQuick.Controls 1.6
+ */
+ property alias wheelEnabled: wheelarea.enabled
+
/*! \internal */
property bool __horizontal: orientation === Qt.Horizontal
diff --git a/src/controls/plugin.cpp b/src/controls/plugin.cpp
index 528f05a8..0d60ec56 100644
--- a/src/controls/plugin.cpp
+++ b/src/controls/plugin.cpp
@@ -122,7 +122,9 @@ static const struct {
{ "TreeView", 1, 4 },
{ "TextArea", 1, 5 },
- { "TreeView", 1, 5 }
+ { "TreeView", 1, 5 },
+
+ { "Slider", 1, 6 }
};
QtQuickControls1Plugin::QtQuickControls1Plugin(QObject *parent) : QQmlExtensionPlugin(parent)
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index 1d7e92d2..4cff6352 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -51,7 +51,7 @@
import QtQuick 2.6
import QtTest 1.0
import QtQuickControlsTests 1.0
-import QtQuick.Controls 1.4
+import QtQuick.Controls 1.6
import QtQuick.Controls.Private 1.0
import QtQuick.Controls.Styles 1.4
@@ -176,6 +176,13 @@ Item {
slider.value = 0
mouseWheel(slider, 5, 5, -40 * ratio, 0)
compare(slider.value, slider.maximumValue)
+
+ // Mousewheel deactivated
+ slider.value = 0
+ slider.wheelEnabled = false
+ mouseWheel(slider, 5, 5, 4 * ratio, 0)
+ compare(slider.value, 0)
+
slider.destroy()
}