diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2019-05-06 18:09:00 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2019-05-07 12:46:24 +0000 |
commit | 807b8cd7524a19d7de45f2be6d924f76c589631b (patch) | |
tree | 0de39892b33734a293ce9e666c7f6eadbe40bd4c | |
parent | af4179e3b1414420a77f10d7de1e244d7eceac4c (diff) |
Doc: Add some more documentation
Change-Id: I150e2344a9a489464fb7b4e5157471472a906afa
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r-- | src/imports/timeline/doc/images/timeline-editor.png | bin | 0 -> 30495 bytes | |||
-rw-r--r-- | src/imports/timeline/doc/images/timeline-settings.png | bin | 0 -> 33310 bytes | |||
-rw-r--r-- | src/imports/timeline/doc/src/qtquicktimeline-index.qdoc | 5 | ||||
-rw-r--r-- | src/imports/timeline/doc/src/qtquicktimeline-overview.qdoc | 23 | ||||
-rw-r--r-- | src/imports/timeline/qquickkeyframe.cpp | 71 | ||||
-rw-r--r-- | src/imports/timeline/qquicktimeline.cpp | 68 | ||||
-rw-r--r-- | src/imports/timeline/qquicktimelineanimation.cpp | 26 |
7 files changed, 192 insertions, 1 deletions
diff --git a/src/imports/timeline/doc/images/timeline-editor.png b/src/imports/timeline/doc/images/timeline-editor.png Binary files differnew file mode 100644 index 0000000..e983c6f --- /dev/null +++ b/src/imports/timeline/doc/images/timeline-editor.png diff --git a/src/imports/timeline/doc/images/timeline-settings.png b/src/imports/timeline/doc/images/timeline-settings.png Binary files differnew file mode 100644 index 0000000..d1affa8 --- /dev/null +++ b/src/imports/timeline/doc/images/timeline-settings.png diff --git a/src/imports/timeline/doc/src/qtquicktimeline-index.qdoc b/src/imports/timeline/doc/src/qtquicktimeline-index.qdoc index ef7bdca..2e49ef3 100644 --- a/src/imports/timeline/doc/src/qtquicktimeline-index.qdoc +++ b/src/imports/timeline/doc/src/qtquicktimeline-index.qdoc @@ -31,7 +31,10 @@ \brief Provides QML types to use timelines and keyframes to animate Qt Quick user interfaces. - + The Qt Quick Timeline module enables keyframe-based animations and + parameterization. It takes a tooling-friendly approach, and is therefore + directly supported by Qt Design Studio and Qt Quick Designer that + contain a timeline editor for creating keyframe based animations. \section1 Getting Started diff --git a/src/imports/timeline/doc/src/qtquicktimeline-overview.qdoc b/src/imports/timeline/doc/src/qtquicktimeline-overview.qdoc index ece4a67..d3106d8 100644 --- a/src/imports/timeline/doc/src/qtquicktimeline-overview.qdoc +++ b/src/imports/timeline/doc/src/qtquicktimeline-overview.qdoc @@ -31,5 +31,28 @@ \title Qt Quick Timeline Overview \brief Describes using timelines in Qt Quick applications. + Timelines can be used to animate items and to define their behavior. + Only one timeline can be active at a particular point in time. + Animating item properties enables their values to move through intermediate + values instead of immediately changing to the target value. For example, + to move an item in a scene, you can animate the properties that control + the item's position, x and y, so that the item's position changes at + keyframes on the way to the target position. Similarly, you could change + the color and scale properties of the item at keyframes to make it appear + to move closer or farther away. + + Qt Design Studio and Qt Quick Designer contain a timeline editor for + creating keyframe based animations. + + \image timeline-editor.png + + Qt Quick allows you to declare various UI states in \l State objects. + These states are comprised of property changes from a base state, and + can be a useful way of organizing your UI logic. Transitions are objects + you can associate with an item to define how its properties will animate + when they change due to a state change. You can bind timeline animations + to states in Qt Design Studio and Qt Quick Designer. + + \image timeline-settings.png */ diff --git a/src/imports/timeline/qquickkeyframe.cpp b/src/imports/timeline/qquickkeyframe.cpp index ceeff5a..47081cc 100644 --- a/src/imports/timeline/qquickkeyframe.cpp +++ b/src/imports/timeline/qquickkeyframe.cpp @@ -124,6 +124,45 @@ public: QVariant value; }; +/*! + \qmltype Keyframe + \inherits QObject + \instantiates QQuickKeyframe + \inqmlmodule QtQuick.Timeline + \ingroup qtqmltypes + + \brief A keyframe. + + The value of a keyframe on a timeline. + + An easing curve can be attached to the keyframe. +*/ + +/*! + \qmlproperty double Keyframe::frame + + The position of the keyframe on the timeline. +*/ + +/*! + \qmlproperty var Keyframe::easing + + The easing curve attached to the keyframe. +*/ + +/*! + \qmlproperty var Keyframe::value + + The value of the keyframe. +*/ + +/*! + \qmlsignal Keyframe::easingCurveChanged + + This signal is emitted when the easing curve attached to the keyframe + changes. +*/ + QQuickKeyframe::QQuickKeyframe(QObject *parent) : QObject(*(new QQuickKeyframePrivate), parent) { @@ -158,6 +197,38 @@ QQuickKeyframe::QQuickKeyframe(QQuickKeyframePrivate &dd, QObject *parent) } +/*! + \qmltype KeyframeGroup + \inherits QObject + \instantiates QQuickKeyframeGroup + \inqmlmodule QtQuick.Timeline + \ingroup qtqmltypes + + \brief A keyframe group. + + A keyframe group contains all keyframes for a specific property of an item + and always belongs to a timeline. +*/ + +/*! + \qmlproperty var KeyframeGroup::target + + The item that is targeted by the keyframe group. +*/ + +/*! + \qmlproperty string KeyframeGroup::property + + The property that is targeted by the keyframe group. +*/ + +/*! + \qmlproperty list KeyframeGroup::keyframes + \readonly + + A list of keyframes that belong to the keyframe group. +*/ + QQuickKeyframeGroup::QQuickKeyframeGroup(QObject *parent) : QObject(*(new QQuickKeyframeGroupPrivate), parent) { diff --git a/src/imports/timeline/qquicktimeline.cpp b/src/imports/timeline/qquicktimeline.cpp index ec1d561..0097a65 100644 --- a/src/imports/timeline/qquicktimeline.cpp +++ b/src/imports/timeline/qquicktimeline.cpp @@ -143,6 +143,74 @@ void QQuickTimelinePrivate::clear_animations(QQmlListProperty<QQuickTimelineAnim } } +/*! + \qmltype Timeline + \inherits QObject + \instantiates QQuickTimeline + \inqmlmodule QtQuick.Timeline + \ingroup qtqmltypes + + \brief A timeline. + + Specifies a timeline with a range of keyframes that contain values for the + properties of an object. The timeline allows specifying the values of items + depending on keyframes and their easing curves. + + A timeline can be either used for animations or to control the behavior of + items. + + For example, it is possible to create a progress bar where the current frame + reflects the progress. +*/ + +/*! + \qmlproperty double Timeline::startFrame + + The start of the timeline. +*/ + +/*! + \qmlproperty double Timeline::endFrame + + The end of the timeline. +*/ + +/*! + \qmlproperty double Timeline::currentFrame + + The current keyframe on the timeline. The current keyframe can be animated + or a binding can be attached to it. Using bindings allows controlling + the behavior of components. +*/ + +/*! + \qmlproperty list Timeline::keyframes + \readonly + + This property contains the keyframe groups attached to the timeline. + Each keyframe group contains a list of keyframes for a specific item + and property. +*/ + +/*! + \qmlproperty list Timeline::animations + \readonly + + A list of animations attached to the timeline. +*/ + +/*! + \qmlproperty bool Timeline::enabled + + Whether the timeline is enabled. + + When the timeline is disabled, all items will have their regular values. + When the timeline is enabled, the values of items are determined by the + current frame and the keyframes. + + Only one timeline should be active at a particular time. +*/ + QQuickTimeline::QQuickTimeline(QObject *parent) : QObject(*(new QQuickTimelinePrivate), parent) { diff --git a/src/imports/timeline/qquicktimelineanimation.cpp b/src/imports/timeline/qquicktimelineanimation.cpp index e833eb1..1e1053c 100644 --- a/src/imports/timeline/qquicktimelineanimation.cpp +++ b/src/imports/timeline/qquicktimelineanimation.cpp @@ -38,6 +38,32 @@ QT_BEGIN_NAMESPACE +/*! + \qmltype TimelineAnimation + \inherits QQuickNumberAnimation + \instantiates QQuickTimelineAnimation + \inqmlmodule QtQuick.Timeline + \ingroup qtqmltypes + + \brief A number animation attached to a timeline. + + Specifies how the current frame property of a timeline is animated. This + animates the properties of the objects targeted by the timeline. +*/ + +/*! + \qmlproperty bool TimelineAnimation::pingPong + + Whether the animation is played backwards after it finishes. This is an easy + way to create circular animations. +*/ + +/*! + \qmlsignal TimelineAnimation::finished + + This signal is emitted when the timeline animation finishes. +*/ + QQuickTimelineAnimation::QQuickTimelineAnimation(QObject *parent) : QQuickNumberAnimation(parent) { setProperty(QLatin1String("currentFrame")); |