QML piece of cake (1) environment setup

Because the project uses QML and C++ development, I recorded it and deepened my understanding. Using win10, QT5.13 creator development. Basically build from scratch

1. Create a new quick project

After the establishment is complete, as shown in the figure,

Contains a pro project main file, the source file main.cpp, a main.qml under the resource file, the main file used to load and interact with C++.

Import should be very familiar, similar to java, python's import, C's #include, only the relevant modules can be used to use the types and functions. The imported module QtQuick module is a set of components selected when creating a project. It contains the basic types and functions required to create a user interface. The Window type is provided in the QtQuick.Window module, which can create a top-level window for the Qt Quick scene. The version number indicates the version of the Qt module used by this code, and the version of the Qt module is downward compatible.

The window object represents a window, and its properties include the visibility, width, height, and text of the window title bar.

Take a look at the project pro file

Look at the source file main.cpp again

C++ uses the engine to load main.qml.

Start the project in the lower left corner

You can see that it is a window with a title, controlled by the properties of main.qml.

Guess you like

Origin blog.csdn.net/qq_41023026/article/details/108551042