diff options
author | Bea Lam <bea.lam@nokia.com> | 2012-08-10 14:40:52 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-16 03:07:48 +0200 |
commit | 520d645259e3f57ea8ab0dab5adb539a9805ac5d (patch) | |
tree | 14bb53b5ac6c30b24eb244b3fd5b2f5c4a7cd7dd /src/quick/items/qquicktranslate.cpp | |
parent | 6aeff1b5429ca97af052a7a172369585382096e8 (diff) |
Move docs closer to the members that they document
This will make it easier to add docs for undocumented members in a
later change.
Includes some minor doc improvements.
Change-Id: I809e1382297af604f7cac3abd4fed4a8e4e55967
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquicktranslate.cpp')
-rw-r--r-- | src/quick/items/qquicktranslate.cpp | 165 |
1 files changed, 152 insertions, 13 deletions
diff --git a/src/quick/items/qquicktranslate.cpp b/src/quick/items/qquicktranslate.cpp index 6cfa7a0338..29f2122069 100644 --- a/src/quick/items/qquicktranslate.cpp +++ b/src/quick/items/qquicktranslate.cpp @@ -56,28 +56,55 @@ public: qreal y; }; + /*! - Constructs an empty QQuickTranslate object with the given \a parent. + \qmltype Translate + \instantiates QQuickTranslate + \inqmlmodule QtQuick 2 + \ingroup qtquick-visual-transforms + \brief Provides a way to move an Item without changing its x or y properties + + The Translate type provides independent control over position in addition + to the Item's x and y properties. + + The following example moves the Y axis of the \l Rectangle items while + still allowing the \l Row to lay the items out as if they had not been + transformed: + + \qml + import QtQuick 2.0 + + Row { + Rectangle { + width: 100; height: 100 + color: "blue" + transform: Translate { y: 20 } + } + Rectangle { + width: 100; height: 100 + color: "red" + transform: Translate { y: -20 } + } + } + \endqml + + \image translate.png */ QQuickTranslate::QQuickTranslate(QObject *parent) : QQuickTransform(*new QQuickTranslatePrivate, parent) { } -/*! - Destroys the graphics scale. -*/ + QQuickTranslate::~QQuickTranslate() { } - /*! - \property QQuickTranslate::x - \brief the horizontal translation. + \qmlproperty real QtQuick2::Translate::x - The translation can be any real number; the default value is 0.0. + The translation along the X axis. - \sa y + The default value is 0.0. */ qreal QQuickTranslate::x() const { @@ -96,12 +123,11 @@ void QQuickTranslate::setX(qreal x) } /*! - \property QQuickTranslate::y - \brief the vertical translation. + \qmlproperty real QtQuick2::Translate::y - The translation can be any real number; the default value is 0.0. + The translation along the Y axis. - \sa x + The default value is 0.0. */ qreal QQuickTranslate::y() const { @@ -135,6 +161,33 @@ public: qreal zScale; }; +/*! + \qmltype Scale + \instantiates QQuickScale + \inqmlmodule QtQuick 2 + \ingroup qtquick-visual-transforms + \brief Provides a way to scale an Item + + The Scale type provides a way to scale an \l Item through a scale-type + transform. + + It allows different scaling values for the x and y axes, and allows the + scale to be relative to an arbitrary point. This gives more control over + item scaling than the \l{Item::}{scale} property. + + The following example scales the X axis of the Rectangle, relative to + its interior point (25, 25): + + \qml + Rectangle { + width: 100; height: 100 + color: "blue" + transform: Scale { origin.x: 25; origin.y: 25; xScale: 3} + } + \endqml + + \sa Rotation, Translate +*/ QQuickScale::QQuickScale(QObject *parent) : QQuickTransform(*new QQuickScalePrivate, parent) { @@ -144,6 +197,16 @@ QQuickScale::~QQuickScale() { } +/*! + \qmlproperty real QtQuick2::Scale::origin.x + \qmlproperty real QtQuick2::Scale::origin.y + + This property holds the point that the item is scaled from (that is, + the point that stays fixed relative to the parent as the rest of the + item grows). + + The default value of the origin is (0, 0). +*/ QVector3D QQuickScale::origin() const { Q_D(const QQuickScale); @@ -159,6 +222,13 @@ void QQuickScale::setOrigin(const QVector3D &point) emit originChanged(); } +/*! + \qmlproperty real QtQuick2::Scale::xScale + + The scaling factor for the X axis. + + The default value is 1.0. +*/ qreal QQuickScale::xScale() const { Q_D(const QQuickScale); @@ -175,6 +245,13 @@ void QQuickScale::setXScale(qreal scale) emit scaleChanged(); } +/*! + \qmlproperty real QtQuick2::Scale::yScale + + The scaling factor for the Y axis. + + The default value is 1.0. +*/ qreal QQuickScale::yScale() const { Q_D(const QQuickScale); @@ -225,6 +302,41 @@ public: QVector3D axis; }; +/*! + \qmltype Rotation + \instantiates QQuickRotation + \inqmlmodule QtQuick 2 + \ingroup qtquick-visual-transforms + \brief Provides a way to rotate an Item + + The Rotation type provides a way to rotate an \l Item through a + rotation-type transform. + + It allows (z axis) rotation to be relative to an arbitrary point, and also + provides a way to specify 3D-like rotations for Items. This gives more + control over item rotation than the \l{Item::}{rotation} property. + + The following example rotates a Rectangle around its interior point + (25, 25): + + \qml + Rectangle { + width: 100; height: 100 + color: "blue" + transform: Rotation { origin.x: 25; origin.y: 25; angle: 45} + } + \endqml + + For 3D-like item rotations, you must specify the axis of rotation in + addition to the origin point. The following example shows various 3D-like + rotations applied to an \l Image. + + \snippet qml/rotation.qml 0 + + \image axisrotation.png + + \sa {declarative/ui-components/dialcontrol}{Dial Control example}, {declarative/toys/clocks}{Clocks example} +*/ QQuickRotation::QQuickRotation(QObject *parent) : QQuickTransform(*new QQuickRotationPrivate, parent) { @@ -234,6 +346,14 @@ QQuickRotation::~QQuickRotation() { } +/*! + \qmlproperty real QtQuick2::Rotation::origin.x + \qmlproperty real QtQuick2::Rotation::origin.y + + The origin point of the rotation (i.e., the point that stays fixed + relative to the parent as the rest of the item rotates). By default + the origin is (0, 0). +*/ QVector3D QQuickRotation::origin() const { Q_D(const QQuickRotation); @@ -250,6 +370,11 @@ void QQuickRotation::setOrigin(const QVector3D &point) emit originChanged(); } +/*! + \qmlproperty real QtQuick2::Rotation::angle + + The angle to rotate, in degrees clockwise. +*/ qreal QQuickRotation::angle() const { Q_D(const QQuickRotation); @@ -265,6 +390,20 @@ void QQuickRotation::setAngle(qreal angle) emit angleChanged(); } +/*! + \qmlproperty real QtQuick2::Rotation::axis.x + \qmlproperty real QtQuick2::Rotation::axis.y + \qmlproperty real QtQuick2::Rotation::axis.z + + The axis to rotate around. For simple (2D) rotation around a point, you + do not need to specify an axis, as the default axis is the z axis + (\c{ axis { x: 0; y: 0; z: 1 } }). + + For a typical 3D-like rotation you will usually specify both the origin + and the axis. + + \image 3d-rotation-axis.png +*/ QVector3D QQuickRotation::axis() const { Q_D(const QQuickRotation); |