I am not too experienced with QML at the moment. This document will go over my knowledge of the QT Modeling Language (QML) so far.
I only know 1 library that needs to be imported, I don't know if it is mandatory for QML.
import QtQuick 2.9 // import from Qt 5.9
Comments in QML are the same as comments in languages such as C, C++, CSS, Java, and Go.
// This is a single line comment
/* This is
a multi-
line
comment */
/* This is
* also a
* multi-
* line
* comment */
break
To this day, I am still not entirely sure what the break
keyword does, but most languages support it.
/!\ This example has not been tested yet, and may not work
A hello world program in QML is pretty simple. It uses this weird keyword known as qsTr
which I don't know what it stands for. This example is likely broken.
helloWorld: qsTr("Hello world")
/!\ This example has not been tested yet, and may not work
This is how you make a rectangle in QML:
Rectangle {
id: myRect
width: 120
height: 100
}
/!\ This example has not been tested yet, and may not work
However, it may require nesting in another object, so I can confirm the next example works:
Item {
Rectangle {
id: myRect
width: 120
height: 100
}
Rectangle {
width: myRect.width
height: 200
}
}
This example was taken from Wikipedia/QML (revision: 1000315038 main article: link)
This example comes from Wikipedia.
import QtQuick 2.9 // import from Qt 5.9
Rectangle {
id: canvas
width: 250
height: 200
color: "blue"
Image {
id: logo
source: "pics/logo.png"
anchors.centerIn: parent
x: canvas.height / 5
}
}
This example was taken from Wikipedia/QML (revision: 1000315038 main article: link)
-
QML is a curly bracket language, but does not use semicolons at the end of each line
-
QML is a modeling language, more of a stylesheet language than a functional one (need confirmation)
-
QML is short for QT Modeling Language
-
QML is designed for the QT framework
-
QML is in use by many Linux projects, including KDE, Tizen, etc.
-
QT has a restrictive license, and is a bit problematic
-
QML uses the
.qml
file extension -
No other knowledge of QML at the moment.