could you be so kind an give me a example
beacuse how to define a variable in qml code:
- add the icon
here is the default Main.qml
when create a new project.
import QtQuick 2.7
import QtQuick.Controls 2.2
import Lomiri.Components 1.3
import QtQuick.Layouts 1.3
import Qt.labs.settings 1.0
import Greeter 1.0
ApplicationWindow {
id: root
objectName: 'mainView'
width: units.gu(45)
height: units.gu(75)
visible: true
Greeter {
id: greeter
name: "Rust + Ubuntu Touch"
}
Page {
anchors.fill: parent
header: PageHeader {
id: header
title: i18n.tr('bla')
}
Icon {
width: units.gu(5)
height: units.gu(5)
name: 'cancel'
}
ColumnLayout {
spacing: units.gu(2)
anchors {
margins: units.gu(2)
top: header.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
Item {
Layout.fillHeight: true
}
Label {
id: label
text: i18n.tr('Press the button below!')
}
Button {
text: i18n.tr('Compute greeting')
onClicked: {
label.text = greeter.compute_greetings("Hello, ");
}
}
Switch {
checked: off
onClicked: {
label.text = greeter.compute_greetings("sw on");
}
}
Item {
Layout.fillHeight: true
}
}
}
}