diff options
| author | Matthias Rauter <matthias.rauter@qt.io> | 2023-03-17 14:33:40 +0100 |
|---|---|---|
| committer | Matthias Rauter <matthias.rauter@qt.io> | 2023-04-28 09:54:16 +0200 |
| commit | d93ca833f65893653071d7ba33fd129fe3db53dc (patch) | |
| tree | 7434a2aed7db461c0392d3757cead8e8dd6e709e /src/quickcontrols/basic/impl/qquickbasicdial_p.h | |
| parent | 0a333bc7e5ae9db1d289a65aa7eef46ae7916936 (diff) | |
Add startAngle and endAngle properties to Dial
The start and end angle of the Dial element were hard coded before. Now
they can be set by the application developer using the new properties
startAngle and endAngle. The angle property is set to an angle between
those values, even if it is >360 or <0. The setter functions make sure
that the relation between angle and value is unique. Further, values for
start and endAngle are limited to [-360, 720]. Wrap works as before.
Tests have been updated.
All styles have been updated to the new functionality except the Imagine
style (see task QTBUG-112387).
[ChangeLog][Controls] The start and end angle of the dial element are
made customizabe.
Fixes: QTBUG-57822
Change-Id: I941837008d4f9b4dde1979e91db5adb624bcbe41
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quickcontrols/basic/impl/qquickbasicdial_p.h')
| -rw-r--r-- | src/quickcontrols/basic/impl/qquickbasicdial_p.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/quickcontrols/basic/impl/qquickbasicdial_p.h b/src/quickcontrols/basic/impl/qquickbasicdial_p.h index 1406bf6906..31e533fdc8 100644 --- a/src/quickcontrols/basic/impl/qquickbasicdial_p.h +++ b/src/quickcontrols/basic/impl/qquickbasicdial_p.h @@ -25,6 +25,8 @@ class QQuickBasicDial : public QQuickPaintedItem { Q_OBJECT Q_PROPERTY(qreal progress READ progress WRITE setProgress FINAL) + Q_PROPERTY(qreal startAngle READ startAngle WRITE setStartAngle FINAL) + Q_PROPERTY(qreal endAngle READ endAngle WRITE setEndAngle FINAL) Q_PROPERTY(QColor color READ color WRITE setColor FINAL) QML_NAMED_ELEMENT(DialImpl) QML_ADDED_IN_VERSION(2, 0) @@ -35,6 +37,12 @@ public: qreal progress() const; void setProgress(qreal progress); + qreal startAngle() const; + void setStartAngle(qreal startAngle); + + qreal endAngle() const; + void setEndAngle(qreal endAngle); + QColor color() const; void setColor(const QColor &color); @@ -42,6 +50,8 @@ public: private: qreal m_progress = 0; + qreal m_startAngle = -140.; + qreal m_endAngle = 140.; QColor m_color = Qt::black; }; |
