Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

QML Example Use timer to update Date

From Qt Wiki
Jump to navigation Jump to search

En Ar Bg De El Es Fa Fi Fr Hi Hu It Ja Kn Ko Ms Nl Pl Pt Ru Sq Th Tr Uk Zh

An example demonstrating how Timer can be used to update Date() in a Text by updating it continuously using a timer.

import QtQuick 1.0

Rectangle {
    id: main
    width: 600
    height: 300

    Text {
        id: foo
        font.pointSize: 12
        function set() {
            foo.text = Date()
        }
    }

    Timer {
        id: textTimer
        interval: 1000
        repeat: true
        running: true
        triggeredOnStart: true
        onTriggered: foo.set()
    }
}