I have a text element in my window and I would like it be blink or appear and disappear for every few seconds or milli seconds.
My code is:
import QtQuick 2.6
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Text {
id: my_text
text: "Hello"
font.pixelSize: 30
}
}
The task is easily solved with a Timer
.
import QtQuick 2.6
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Text {
id: my_text
font.pixelSize: 30
text: "Hello"
}
Timer{
id: timer
interval: 1000
running: true
repeat: true
onTriggered: my_text.opacity = my_text.opacity === 0 ? 1 : 0
}
}