diff options
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qmlpropertychanges.cpp | 37 | ||||
-rw-r--r-- | src/declarative/util/qmltimer.cpp | 25 |
2 files changed, 39 insertions, 23 deletions
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index 6a393ee..9ca6db8 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -56,19 +56,32 @@ QT_BEGIN_NAMESPACE \qmlclass PropertyChanges QmlPropertyChanges \brief The PropertyChanges element describes new property values for a state. - PropertyChanges changes the properties of an item. It allows you to specify the property - names and values for a state similar to how you normally would specify them for the - actual item: + PropertyChanges provides a state change that modifies the properties of an item. - \code - PropertyChanges { - target: myRect - x: 52 - y: 300 - width: 48 - } - \endcode + Here is a property change that modifies the text and color of a Text element + when it is clicked: + + \qml + Text { + id: myText + width: 100; height: 100 + text: "Hello" + color: "blue" + + states: State { + name: "myState" + + PropertyChanges { + target: myText + text: "Goodbye" + color: "red" + } + } + MouseRegion { anchors.fill: parent; onClicked: myText.state = 'myState' } + } + \endqml + State-specific script for signal handlers can also be specified: \qml @@ -92,7 +105,7 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty Object PropertyChanges::target - This property holds the object that the properties to change belong to + This property holds the object which contains the properties to be changed. */ class QmlReplaceSignalHandler : public ActionEvent diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp index d2198f2..0a2448a 100644 --- a/src/declarative/util/qmltimer.cpp +++ b/src/declarative/util/qmltimer.cpp @@ -73,6 +73,9 @@ public: A timer can be used to trigger an action either once, or repeatedly at a given interval. + Here is a timer that shows the current date and time, and updates + the text every 500 milliseconds: + \qml Timer { interval: 500; running: true; repeat: true @@ -107,7 +110,7 @@ QmlTimer::QmlTimer(QObject *parent) /*! \qmlproperty int Timer::interval - Sets the \a interval in milliseconds between triggering. + Sets the \a interval between triggers, in milliseconds. The default interval is 1000 milliseconds. */ @@ -130,7 +133,7 @@ int QmlTimer::interval() const \qmlproperty bool Timer::running If set to true, starts the timer; otherwise stops the timer. - For a non-repeating timer, \a running will be set to false after the + For a non-repeating timer, \a running is set to false after the timer has been triggered. \a running defaults to false. @@ -157,7 +160,7 @@ void QmlTimer::setRunning(bool running) /*! \qmlproperty bool Timer::repeat - If \a repeat is true the timer will be triggered repeatedly at the + If \a repeat is true the timer is triggered repeatedly at the specified interval; otherwise, the timer will trigger once at the specified interval and then stop (i.e. running will be set to false). @@ -183,15 +186,15 @@ void QmlTimer::setRepeating(bool repeating) /*! \qmlproperty bool Timer::triggeredOnStart - When the Timer is started the first trigger is normally after the specified - interval has elapsed. It is sometimes desireable to trigger immediately - when the timer is started, for example to establish an initial + When a timer is started, the first trigger is usually after the specified + interval has elapsed. It is sometimes desirable to trigger immediately + when the timer is started; for example, to establish an initial state. - If \a triggeredOnStart is true, the timer will be triggered immediately - when started, and subsequently at the specified interval. Note that for - a Timer with \e repeat set to false, this will result in the timer being - triggered twice; once on start, and again at the interval. + If \a triggeredOnStart is true, the timer is triggered immediately + when started, and subsequently at the specified interval. Note that if + \e repeat is set to false, the timer is triggered twice; once on start, + and again at the interval. \a triggeredOnStart defaults to false. @@ -226,7 +229,7 @@ void QmlTimer::start() /*! \qmlmethod Timer::stop() - \brief stops the timer. + \brief Stops the timer. If the timer is not running, calling this method has no effect. The \c running property will be false following a call to \c stop(). |