QML also called Qt quick. Qt Quick is an advanced user interface technology. It makes it easy to create dynamic touch-side and lightweight applications for mobile and embedded devices. Three new technologies together form the QT Quick user interface: An improved QT Creator IDE, a new easy-to-learn language (QML), and a newly added module called the QT Library named Qtdeclarative, which makes QT more accessible for unfamiliar C + + For developers and designers who use it.
1.scene Scenario Tool:
Is the QT built-in view of a single QML file running results of the EXE program, can be found in the directory of the Qt bin, called Qmlscene.exe; Open will go directly to the file selection, when you choose to navigate to the corresponding QML file, you can see the effect of running.
2. A simple Hello Program
<1> new QT Selection qt Quick Application project
<2> if it is qt5.4 and above, will be prompted whether to establish the opposite interface file, you can choose, or do not choose.
<3> if the interface file is selected, the following MAIN.QML file will be generated by default
Import QtQuick 2.4
Import Qtquick.window 2.2
Window {
Visible:true
width:640
height:480
TITLE:QSTR ("Hello World")
MainForm {
Anchors.fill:parent
Mousearea.onclicked: {
Qt.quit ();
}
}
}
The run will find the word "Hello World" in the middle of the screen, but obviously this is not the hello we want. At this point, if you modify the Hello World in the title, you will find that the program you are running only changes the title and the content is unchanged. Careful observation, found below the application of a MainForm object, you can try to open it, you will find that there are two types of text editing mode and interface mode, both states can modify the interface.
However, if you want to generate a program to print hello in a single qml, which is our main.qml, then you need to delete the MainForm section and modify it to the following code:
text{
Text: "Hello";
Anchors.centerIn:parent
Color: "Cyan"
Font.pointsize:30
}
The operation is now found to be correct, but our interface file is not called at this time .... (Individuals feel that they can choose between two ways according to their own habits)