QOwnNotes/docs/scripting/examples/scripting-label-demo.qml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1 KiB
QML
Raw Normal View History

2017-05-08 19:21:21 +02:00
import QtQml 2.0
2022-08-20 19:27:32 +02:00
import QOwnNotesTypes 1.0
2017-05-08 19:21:21 +02:00
/**
* This script creates scripting labels
*
*/
2022-08-20 19:27:32 +02:00
Script {
2017-05-08 19:21:21 +02:00
/**
* Initializes the labels
*/
function init() {
2018-09-09 08:46:11 +02:00
script.registerLabel("html-label", "<strong>Strong</strong> HTML text<br />with three lines<br />and a <a href='https://www.qownnotes.org'>link to a website</a>.");
2017-05-08 19:21:21 +02:00
2019-09-10 18:21:43 +02:00
script.registerLabel("long-label", "another very long text, another very long text, another very long text, another very long text, another very long text, another very long text, another very long text, another very long text, another very long text, another very long text, another very long text that will wrap");
2017-05-08 19:21:21 +02:00
script.registerLabel("counter-label");
}
/**
* This starts a timer that triggers two seconds
*/
property QtObject timer: Timer {
interval: 1000
repeat: true
running: true
property int count: 0
onTriggered: {
count++;
script.setLabelText("counter-label", "count = " + count);
}
}
}