summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/fx/qfxpath.cpp137
-rw-r--r--src/declarative/fx/qfxpath.h68
2 files changed, 120 insertions, 85 deletions
diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp
index 06c9f2b..2009237 100644
--- a/src/declarative/fx/qfxpath.cpp
+++ b/src/declarative/fx/qfxpath.cpp
@@ -47,8 +47,8 @@
QT_BEGIN_NAMESPACE
QML_DEFINE_TYPE(QFxPath,Path);
-QML_DEFINE_TYPE(QFxPathElement,PathElement);
-QML_DEFINE_TYPE(QFxCurve,Curve);
+QML_DEFINE_NOCREATE_TYPE(QFxPathElement);
+QML_DEFINE_NOCREATE_TYPE(QFxCurve);
QML_DEFINE_TYPE(QFxPathAttribute,PathAttribute);
QML_DEFINE_TYPE(QFxPathPercent,PathPercent);
QML_DEFINE_TYPE(QFxPathLine,PathLine);
@@ -56,10 +56,35 @@ QML_DEFINE_TYPE(QFxPathQuad,PathQuad);
QML_DEFINE_TYPE(QFxPathCubic,PathCubic);
/*!
- \qmlclass Path
+ \qmlclass PathElement
+ \brief PathElement is the base path element.
+
+ This element is the base for all path elements. It cannot
+ be instantiated.
+
+ \sa Path, PathAttribute, PathPercent, PathLine, PathQuad, PathCubic
+*/
+
+/*!
+ \internal
+ \class QFxPathElement
+ \ingroup group_utility
+*/
+
+/*!
+ \qmlclass Path QFxPath
\brief The Path element defines a path for use by \l PathView.
- \sa PathElement, PathAttribute, PathPercent, PathLine, PathQuad, PathCubic
+ A Path is composed of one or more path segments - PathLine, PathQuad,
+ PathCubic.
+
+ The spacing of the items along the Path can be adjusted via the
+ PathPercent element.
+
+ PathAttribute allows named attributes with values to be defined
+ along the path.
+
+ \sa PathView, PathAttribute, PathPercent, PathLine, PathQuad, PathCubic
*/
/*!
@@ -84,8 +109,9 @@ QFxPath::~QFxPath()
}
/*!
- \qmlproperty int Path::startX
- This property holds the starting x position of the path.
+ \qmlproperty real Path::startX
+ \qmlproperty real Path::startY
+ This property holds the starting position of the path.
*/
/*!
@@ -93,35 +119,31 @@ QFxPath::~QFxPath()
\brief the starting x position of the path.
*/
-int QFxPath::startX() const
+qreal QFxPath::startX() const
{
Q_D(const QFxPath);
return d->startX;
}
-void QFxPath::setStartX(int x)
+void QFxPath::setStartX(qreal x)
{
Q_D(QFxPath);
d->startX = x;
}
-/*!
- \qmlproperty int Path::startY
- This property holds the starting y position of the path.
-*/
/*!
\property QFxPath::startY
\brief the starting y position of the path.
*/
-int QFxPath::startY() const
+qreal QFxPath::startY() const
{
Q_D(const QFxPath);
return d->startY;
}
-void QFxPath::setStartY(int y)
+void QFxPath::setStartY(qreal y)
{
Q_D(QFxPath);
d->startY = y;
@@ -433,12 +455,12 @@ qreal QFxPath::attributeAt(const QString &name, qreal percent) const
/****************************************************************************/
-int QFxCurve::x() const
+qreal QFxCurve::x() const
{
return _x;
}
-void QFxCurve::setX(int x)
+void QFxCurve::setX(qreal x)
{
if (_x != x) {
_x = x;
@@ -446,12 +468,12 @@ void QFxCurve::setX(int x)
}
}
-int QFxCurve::y() const
+qreal QFxCurve::y() const
{
return _y;
}
-void QFxCurve::setY(int y)
+void QFxCurve::setY(qreal y)
{
if (_y != y) {
_y = y;
@@ -567,7 +589,6 @@ void QFxPathAttribute::setValue(qreal value)
\endcode
\sa Path, PathQuad, PathCubic
-
*/
/*!
@@ -579,6 +600,13 @@ void QFxPathAttribute::setValue(qreal value)
\sa QFxPath
*/
+/*!
+ \qmlproperty real PathLine::x
+ \qmlproperty real PathLine::y
+
+ Defines the end point of the line.
+*/
+
void QFxPathLine::addToPath(QPainterPath &path)
{
path.lineTo(x(), y());
@@ -614,20 +642,30 @@ void QFxPathLine::addToPath(QPainterPath &path)
\sa QFxPath
*/
+
+/*!
+ \qmlproperty real PathQuad::x
+ \qmlproperty real PathQuad::y
+
+ Defines the end point of the curve.
+*/
+
/*!
- \qmlproperty string PathQuad::controlX
- The x position of the control point.
+ \qmlproperty real PathQuad::controlX
+ \qmlproperty real PathQuad::controlY
+
+ Defines the position of the control point.
*/
/*!
the x position of the control point.
*/
-int QFxPathQuad::controlX() const
+qreal QFxPathQuad::controlX() const
{
return _controlX;
}
-void QFxPathQuad::setControlX(int x)
+void QFxPathQuad::setControlX(qreal x)
{
if (_controlX != x) {
_controlX = x;
@@ -635,20 +673,16 @@ void QFxPathQuad::setControlX(int x)
}
}
-/*!
- \qmlproperty string PathQuad::controlY
- The y position of the control point.
-*/
/*!
the y position of the control point.
*/
-int QFxPathQuad::controlY() const
+qreal QFxPathQuad::controlY() const
{
return _controlY;
}
-void QFxPathQuad::setControlY(int y)
+void QFxPathQuad::setControlY(qreal y)
{
if (_controlY != y) {
_controlY = y;
@@ -693,20 +727,29 @@ void QFxPathQuad::addToPath(QPainterPath &path)
*/
/*!
- \qmlproperty string PathCubic::control1X
- the x position of the first control point.
+ \qmlproperty real PathCubic::x
+ \qmlproperty real PathCubic::y
+
+ Defines the end point of the curve.
+*/
+
+/*!
+ \qmlproperty real PathCubic::control1X
+ \qmlproperty real PathCubic::control1Y
+
+ Defines the position of the first control point.
*/
/*!
\property QFxPathCubic::control1X
\brief the x position of the first control point.
*/
-int QFxPathCubic::control1X() const
+qreal QFxPathCubic::control1X() const
{
return _control1X;
}
-void QFxPathCubic::setControl1X(int x)
+void QFxPathCubic::setControl1X(qreal x)
{
if (_control1X != x) {
_control1X = x;
@@ -715,20 +758,15 @@ void QFxPathCubic::setControl1X(int x)
}
/*!
- \qmlproperty string PathCubic::control1Y
- the y position of the first control point.
-*/
-
-/*!
\property QFxPathCubic::control1Y
\brief the y position of the first control point.
*/
-int QFxPathCubic::control1Y() const
+qreal QFxPathCubic::control1Y() const
{
return _control1Y;
}
-void QFxPathCubic::setControl1Y(int y)
+void QFxPathCubic::setControl1Y(qreal y)
{
if (_control1Y != y) {
_control1Y = y;
@@ -737,20 +775,22 @@ void QFxPathCubic::setControl1Y(int y)
}
/*!
- \qmlproperty string PathCubic::control2X
- the x position of the second control point.
+ \qmlproperty real PathCubic::control2X
+ \qmlproperty real PathCubic::control2Y
+
+ Defines the position of the second control point.
*/
/*!
\property QFxPathCubic::control2X
\brief the x position of the second control point.
*/
-int QFxPathCubic::control2X() const
+qreal QFxPathCubic::control2X() const
{
return _control2X;
}
-void QFxPathCubic::setControl2X(int x)
+void QFxPathCubic::setControl2X(qreal x)
{
if (_control2X != x) {
_control2X = x;
@@ -759,20 +799,15 @@ void QFxPathCubic::setControl2X(int x)
}
/*!
- \qmlproperty string PathCubic::control2Y
- the y position of the second control point.
-*/
-
-/*!
\property QFxPathCubic::control2Y
\brief the y position of the second control point.
*/
-int QFxPathCubic::control2Y() const
+qreal QFxPathCubic::control2Y() const
{
return _control2Y;
}
-void QFxPathCubic::setControl2Y(int y)
+void QFxPathCubic::setControl2Y(qreal y)
{
if (_control2Y != y) {
_control2Y = y;
diff --git a/src/declarative/fx/qfxpath.h b/src/declarative/fx/qfxpath.h
index a9c48ed..c594793 100644
--- a/src/declarative/fx/qfxpath.h
+++ b/src/declarative/fx/qfxpath.h
@@ -89,22 +89,22 @@ class Q_DECLARATIVE_EXPORT QFxCurve : public QFxPathElement
{
Q_OBJECT
- Q_PROPERTY(int x READ x WRITE setX NOTIFY changed)
- Q_PROPERTY(int y READ y WRITE setY NOTIFY changed)
+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY changed)
+ Q_PROPERTY(qreal y READ y WRITE setY NOTIFY changed)
public:
QFxCurve(QObject *parent=0) : QFxPathElement(parent), _x(0), _y(0) {}
- int x() const;
- void setX(int x);
+ qreal x() const;
+ void setX(qreal x);
- int y() const;
- void setY(int y);
+ qreal y() const;
+ void setY(qreal y);
virtual void addToPath(QPainterPath &) {}
private:
- int _x;
- int _y;
+ qreal _x;
+ qreal _y;
};
QML_DECLARE_TYPE(QFxCurve);
@@ -122,22 +122,22 @@ class Q_DECLARATIVE_EXPORT QFxPathQuad : public QFxCurve
{
Q_OBJECT
- Q_PROPERTY(int controlX READ controlX WRITE setControlX NOTIFY changed)
- Q_PROPERTY(int controlY READ controlY WRITE setControlY NOTIFY changed)
+ Q_PROPERTY(qreal controlX READ controlX WRITE setControlX NOTIFY changed)
+ Q_PROPERTY(qreal controlY READ controlY WRITE setControlY NOTIFY changed)
public:
QFxPathQuad(QObject *parent=0) : QFxCurve(parent), _controlX(0), _controlY(0) {}
- int controlX() const;
- void setControlX(int x);
+ qreal controlX() const;
+ void setControlX(qreal x);
- int controlY() const;
- void setControlY(int y);
+ qreal controlY() const;
+ void setControlY(qreal y);
void addToPath(QPainterPath &path);
private:
- int _controlX;
- int _controlY;
+ qreal _controlX;
+ qreal _controlY;
};
QML_DECLARE_TYPE(QFxPathQuad);
@@ -145,24 +145,24 @@ class Q_DECLARATIVE_EXPORT QFxPathCubic : public QFxCurve
{
Q_OBJECT
- Q_PROPERTY(int control1X READ control1X WRITE setControl1X NOTIFY changed)
- Q_PROPERTY(int control1Y READ control1Y WRITE setControl1Y NOTIFY changed)
- Q_PROPERTY(int control2X READ control2X WRITE setControl2X NOTIFY changed)
- Q_PROPERTY(int control2Y READ control2Y WRITE setControl2Y NOTIFY changed)
+ Q_PROPERTY(qreal control1X READ control1X WRITE setControl1X NOTIFY changed)
+ Q_PROPERTY(qreal control1Y READ control1Y WRITE setControl1Y NOTIFY changed)
+ Q_PROPERTY(qreal control2X READ control2X WRITE setControl2X NOTIFY changed)
+ Q_PROPERTY(qreal control2Y READ control2Y WRITE setControl2Y NOTIFY changed)
public:
QFxPathCubic(QObject *parent=0) : QFxCurve(parent), _control1X(0), _control1Y(0), _control2X(0), _control2Y(0) {}
- int control1X() const;
- void setControl1X(int x);
+ qreal control1X() const;
+ void setControl1X(qreal x);
- int control1Y() const;
- void setControl1Y(int y);
+ qreal control1Y() const;
+ void setControl1Y(qreal y);
- int control2X() const;
- void setControl2X(int x);
+ qreal control2X() const;
+ void setControl2X(qreal x);
- int control2Y() const;
- void setControl2Y(int y);
+ qreal control2Y() const;
+ void setControl2Y(qreal y);
void addToPath(QPainterPath &path);
@@ -196,8 +196,8 @@ class Q_DECLARATIVE_EXPORT QFxPath : public QObject, public QmlParserStatus
Q_INTERFACES(QmlParserStatus);
Q_PROPERTY(QList<QFxPathElement *>* pathElements READ pathElements)
- Q_PROPERTY(int startX READ startX WRITE setStartX)
- Q_PROPERTY(int startY READ startY WRITE setStartY)
+ Q_PROPERTY(qreal startX READ startX WRITE setStartX)
+ Q_PROPERTY(qreal startY READ startY WRITE setStartY)
Q_CLASSINFO("DefaultProperty", "pathElements")
Q_INTERFACES(QmlParserStatus)
public:
@@ -206,11 +206,11 @@ public:
QList<QFxPathElement *>* pathElements();
- int startX() const;
- void setStartX(int x);
+ qreal startX() const;
+ void setStartX(qreal x);
- int startY() const;
- void setStartY(int y);
+ qreal startY() const;
+ void setStartY(qreal y);
QPainterPath path() const;
QStringList attributes() const;