diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2016-04-15 16:41:26 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2016-04-19 10:41:44 +0000 |
commit | e253427f93248983d18055c5020094799a2c6b3b (patch) | |
tree | 6daec4a792e0a68b236f0c11a891e7cb72e08907 /src/quicktemplates2/qquickdial_p.h | |
parent | 30b2d62262e4ecfadf89dc0ee34644bebe5194fc (diff) |
Dial: add wrap property
This works by preventing changes in position that are considered
too large. A change is considered too large when the difference
between the old and new positions is greater than or equal to 0.5
*and* the position of the mouse is below the center of the dial.
This effectively makes it impossible to drag the dial from left
to right when the mouse is below its center, but still allows
doing so above its center.
This is useful for applications such as volume dials, where a
large change can be dangerous.
Change-Id: I1d7800e5ba16dbe0642974b8e53d8fcd921a01d7
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickdial_p.h')
-rw-r--r-- | src/quicktemplates2/qquickdial_p.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickdial_p.h b/src/quicktemplates2/qquickdial_p.h index 6c83baef..f736e607 100644 --- a/src/quicktemplates2/qquickdial_p.h +++ b/src/quicktemplates2/qquickdial_p.h @@ -67,6 +67,7 @@ class Q_QUICKTEMPLATES2_EXPORT QQuickDial : public QQuickControl Q_PROPERTY(qreal angle READ angle NOTIFY angleChanged FINAL) Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL) Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL) + Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged FINAL) Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL) Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL) @@ -99,6 +100,9 @@ public: SnapMode snapMode() const; void setSnapMode(SnapMode mode); + bool wrap() const; + void setWrap(bool wrap); + bool isPressed() const; void setPressed(bool pressed); @@ -117,6 +121,7 @@ Q_SIGNALS: void angleChanged(); void stepSizeChanged(); void snapModeChanged(); + void wrapChanged(); void pressedChanged(); void handleChanged(); |