Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / src / quick / util / qdeclarativepathinterpolator.cpp
index 569884d..7550d54 100644 (file)
@@ -1,8 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
 
 QT_BEGIN_NAMESPACE
 
+/*!
+    \qmlclass PathInterpolator QQuickPathInterpolator
+    \inqmlmodule QtQuick 2
+    \brief The PathInterpolator element provides a way to manually animate along a path.
+
+    PathInterpolator provides \c x, \c y, and \c angle information for a particular \c progress
+    along a path.
+
+    In the following example, we animate a green rectangle along a bezier path.
+
+    \snippet doc/src/snippets/declarative/pathinterpolator.qml 0
+*/
+
 QDeclarativePathInterpolator::QDeclarativePathInterpolator(QObject *parent) :
     QObject(parent), _path(0), _x(0), _y(0), _angle(0), _progress(0)
 {
 }
 
+/*!
+    \qmlproperty Path QtQuick2::PathInterpolator::path
+    This property holds the path to interpolate.
+
+    For more information on defining a path see the \l Path documentation.
+*/
 QDeclarativePath *QDeclarativePathInterpolator::path() const
 {
     return _path;
@@ -66,6 +85,16 @@ void QDeclarativePathInterpolator::setPath(QDeclarativePath *path)
     emit pathChanged();
 }
 
+/*!
+    \qmlproperty real QtQuick2::PathInterpolator::progress
+    This property holds the current progress along the path.
+
+    Typical usage of PathInterpolator is to set the progress
+    (often via a NumberAnimation), and read the corresponding
+    values for x, y, and angle (often via bindings to these values).
+
+    Progress ranges from 0.0 to 1.0.
+*/
 qreal QDeclarativePathInterpolator::progress() const
 {
     return _progress;
@@ -80,6 +109,12 @@ void QDeclarativePathInterpolator::setProgress(qreal progress)
     _q_pathUpdated();
 }
 
+/*!
+    \qmlproperty real QtQuick2::PathInterpolator::x
+    \qmlproperty real QtQuick2::PathInterpolator::y
+
+    These properties hold the position of the path at \l progress.
+*/
 qreal QDeclarativePathInterpolator::x() const
 {
     return _x;
@@ -90,6 +125,13 @@ qreal QDeclarativePathInterpolator::y() const
     return _y;
 }
 
+/*!
+    \qmlproperty real QtQuick2::PathInterpolator::angle
+
+    This property holds the angle of the path tangent at \l progress.
+
+    Angles are reported clockwise, with zero degrees at the 3 o'clock position.
+*/
 qreal QDeclarativePathInterpolator::angle() const
 {
     return _angle;
@@ -113,6 +155,11 @@ void QDeclarativePathInterpolator::_q_pathUpdated()
         emit yChanged();
     }
 
+    //convert to clockwise
+    angle = qreal(360) - angle;
+    if (qFuzzyCompare(angle, qreal(360)))
+        angle = qreal(0);
+
     if (angle != _angle) {
         _angle = angle;
         emit angleChanged();