Overview

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

  1. import QtQuick 1.0
  2.  
  3. Rectangle {
  4.  id: main
  5.  width: 600; height: 300
  6.  
  7.  Text {
  8.   id: foo
  9.   font.pointSize: 12
  10.   function set(){
  11.    foo.text = Date();
  12.   }
  13.  }
  14.  
  15.  Timer {
  16.   id: textTimer
  17.   interval: 1000
  18.   repeat: true
  19.   running: true
  20.   triggeredOnStart: true
  21.   onTriggered: {
  22.    foo.set();
  23.   }
  24.  }
  25. }

Categories: