diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-01-04 14:31:23 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-01-10 14:47:41 +0000 |
commit | 81d204e2a5118b2d81862fa9d9a45e5522396a45 (patch) | |
tree | 3d44bfb5b950c81b1560836d464955f304d6fd25 /src/quick/util/qquickpath.cpp | |
parent | 1977ed5e1852615cbb2c17aaf9a82b0d983fe2f6 (diff) |
Add X axis rotation property to PathArc
It is a standard feature of elliptical arc. While perhaps deemed too
advanced for PathView purposes, rendering the path using PathItem must
offer the ability to specify a non-zero X axis rotation for the
ellipses of which the arc is a section of.
Change-Id: I53f01713b7e0e97c40f22d75d46f75a140830683
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/util/qquickpath.cpp')
-rw-r--r-- | src/quick/util/qquickpath.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index a6fa21d696..228056fdb5 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -1799,6 +1799,42 @@ void QQuickPathArc::setDirection(ArcDirection direction) emit changed(); } +/*! + \qmlproperty real QtQuick::PathArc::xAxisRotation + + Defines the rotation of the arc, in degrees. The default value is 0. + + An arc is a section of circles or ellipses. Given the radius and the start + and end points, there are two ellipses that connect the points. This + property defines the rotation of the X axis of these ellipses. + + \note The value is only useful when the x and y radius differ, meaning the + arc is a section of ellipses. + + The following QML demonstrates how different radius values can be used to change + the shape of the arc: + \table + \row + \li \image declarative-arcrotation.png + \li \snippet qml/path/arcrotation.qml 0 + \endtable +*/ + +qreal QQuickPathArc::xAxisRotation() const +{ + return _xAxisRotation; +} + +void QQuickPathArc::setXAxisRotation(qreal rotation) +{ + if (_xAxisRotation == rotation) + return; + + _xAxisRotation = rotation; + emit xAxisRotationChanged(); + emit changed(); +} + void QQuickPathArc::addToPath(QPainterPath &path, const QQuickPathData &data) { const QPointF &startPoint = path.currentPosition(); @@ -1806,7 +1842,7 @@ void QQuickPathArc::addToPath(QPainterPath &path, const QQuickPathData &data) QQuickSvgParser::pathArc(path, _radiusX, _radiusY, - 0, //xAxisRotation + _xAxisRotation, _useLargeArc, _direction == Clockwise ? 1 : 0, endPoint.x(), |