当前位置:网站首页>Qt Widget project loading example of qml
Qt Widget project loading example of qml
2022-08-01 05:20:00 【Wang Kairui】
step1: First, we create a new widget project, File -- "New Project -- " Application -- " Qt Widget Application -- "...
step2: Create a new qml file, right-click the project name, select "Add New File" --> Qt --> QML file --> .....
Key steps are documented here, and subsequent general steps are not listed.After the new creation is completed, the directory structure is as follows:

Step 3: Edit the qml file, add code, and add a display interface

Source code:
import QtQuick 2.0import QtQuick.Controls 2.1import QtQuick.Window 2.0Window { /*Create a new display interface*/visible: true /*Set the display interface to be visible*/height: 480width: 640 /*Set the height and width of the interface*/title: "QML load test" /*Set the interface title*/}Step 4: Add relevant code to main.cpp and block the widget display interface
Source code:
#include "widget.h"#include #include /*Add header file*/int main(int argc, char *argv[]){QApplication a(argc, argv);/*Block the widget display interface*///Widget w;//w.show();QQmlApplicationEngine qmleng; /*Instantiate the qmleng object*/qmleng.load(QUrl(QStringLiteral("../appLoadQml/uiQml.qml"))); /*Display interface through qmlengine*/return a.exec();} step5: Add the qml module to the *.pro file

step 6: Compile and run

边栏推荐
- torch
- vsce package 后出现 Command failed: npm list --production --parseable --depth=99999 --loglevel=error异常
- 剑指 Offer 68 - II. 二叉树的最近公共祖先
- leetcode125 验证回文串
- (2022 Nioke Duo School IV) D-Jobs (Easy Version) (3D prefix or)
- Robot_Framework: Assertion
- Robot_Framework: keyword
- 2022.7.26 模拟赛
- 冲刺金九银十,Android开发面试(内含面试资料|面试题|源码)
- (2022牛客多校四)N-Particle Arts(思维)
猜你喜欢
随机推荐
LeetCode 9. 回文数
Selenium:元素判断
typescript24 - type inference
剑指 Offer 68 - II. 二叉树的最近公共祖先
万字逐行解析与实现Transformer,并进行德译英实战(三)
华为Android开发面试后得出的面试秘诀
(2022牛客多校四)K-NIO‘s Sword(思维)
Seleniu: Common operations on elements
uva10825
Selenium: upload and download files
(2022 Niu Ke Duo School IV) K-NIO's Sword (Thinking)
Selenium: element judgment
vsce package 后出现 Command failed: npm list --production --parseable --depth=99999 --loglevel=error异常
What should I do if the neural network cannot be trained?
微信小程序获取手机号phonenumber.getPhoneNumber接口开发
leetcode43 字符串相乘
About making a progress bar for software initialization for Qt
关于给Qt做一个软件初始化的进度条
The sword refers to Offer 68 - I. Nearest Common Ancestor of Binary Search Trees
pytorch、tensorflow对比学习—功能组件(优化器、评估指标、Module管理)








