src/declarative/util/qdeclarativetimer.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    68     bool firstTick : 1;
    68     bool firstTick : 1;
    69 };
    69 };
    70 
    70 
    71 /*!
    71 /*!
    72     \qmlclass Timer QDeclarativeTimer
    72     \qmlclass Timer QDeclarativeTimer
       
    73     \ingroup qml-utility-elements
    73     \since 4.7
    74     \since 4.7
    74     \brief The Timer item triggers a handler at a specified interval.
    75     \brief The Timer item triggers a handler at a specified interval.
    75 
    76 
    76     A timer can be used to trigger an action either once, or repeatedly
    77     A Timer can be used to trigger an action either once, or repeatedly
    77     at a given interval.
    78     at a given interval.
    78 
    79 
    79     Here is a timer that shows the current date and time, and updates
    80     Here is a Timer that shows the current date and time, and updates
    80     the text every 500 milliseconds:
    81     the text every 500 milliseconds. It uses the JavaScript \c Date
       
    82     object to access the current time.
    81 
    83 
    82     \qml
    84     \qml
    83     import Qt 4.7
    85     import Qt 4.7
    84 
    86 
    85     Item {
    87     Item {
    86         Timer {
    88         Timer {
    87             interval: 500; running: true; repeat: true
    89             interval: 500; running: true; repeat: true
    88             onTriggered: time.text = Date().toString()
    90             onTriggered: time.text = Date().toString()
    89         }
    91         }
    90 
    92 
    91         Text {
    93         Text { id: time }
    92             id: time
       
    93         }
       
    94     }
    94     }
    95     \endqml
    95     \endqml
    96 
    96 
    97     The Timer element is synchronized with the animation timer.  Since the animation
    97     The Timer element is synchronized with the animation timer.  Since the animation
    98     timer is usually set to 60fps, the resolution of Timer will be
    98     timer is usually set to 60fps, the resolution of Timer will be