当前位置:网站首页>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
边栏推荐
- 万字逐行解析与实现Transformer,并进行德译英实战(三)
- 剑指 Offer 68 - II. 二叉树的最近公共祖先
- Selenium:简介
- Induction jian hai JustFE 2022/07/29 team, I learned the efficient development summary (years)
- matplotlib pyplot
- (2022牛客多校四)K-NIO‘s Sword(思维)
- MySQL-Data Operation-Group Query-Join Query-Subquery-Pagination Query-Joint Query
- DL-31/6电流继电器
- Robot growth in China
- II. Binary tree to Offer 68 - recent common ancestor
猜你喜欢
移动应用恶意攻击激增500% 三六零天御为APP免费构建安全屏障
(Codeforce 757) E. Bash Plays with Functions
程序员代码面试指南 CD15 生成窗口最大值数组
可视化全链路日志追踪
NDK does not contain any platforms problem solving
state compressed dp
Power button (LeetCode) 212. The word search II (2022.07.31)
Robot_Framework: Assertion
华为Android开发面试后得出的面试秘诀
Hunan institute of technology in 2022 ACM training sixth week antithesis
随机推荐
微信小程序接口调用凭证(获取token)auth.getAccessToken接口开发
Selenium: form switching
matplotlib pyplot
A,H,K,N
leetcode125 验证回文串
Logitech Mouse Experience Record
leetcode43 string multiplication
The solution to the inconsistency between the PaddleX deployment inference model and the GUI interface test results
uva10825
vsce package 后出现 Command failed: npm list --production --parseable --depth=99999 --loglevel=error异常
Selenium:元素定位
万字逐行解析与实现Transformer,并进行德译英实战(二)
The method of solving stored procedure table name passing through variable in mysql
程序员代码面试指南 CD15 生成窗口最大值数组
leetcode43 字符串相乘
将CSV文件快速导入MySQL中
微信小程序获取手机号phonenumber.getPhoneNumber接口开发
Challenge 52 days to memorize Peppa Pig (Day 01)
(more than 2022 cattle school four) A - Task Computing + dynamic programming (sort)
MySQL-数据定义语言-DDLdatebase define language