当前位置:网站首页>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

边栏推荐
- 使用string 容器翻转 字母
- MySQL-数据操作-分组查询-连接查询-子查询-分页查询-联合查询
- 华为Android开发面试后得出的面试秘诀
- Selenium: element judgment
- 【MySQL必知必会】 表的优化 | 充分利用系统资源
- vsce package 后出现 Command failed: npm list --production --parseable --depth=99999 --loglevel=error异常
- LeetCode 9. 回文数
- I met a shell script
- Code Interview Guide for Programmers CD15 Generating an Array of Windowed Maximums
- Selenium: element positioning
猜你喜欢

七、MFC序列化机制和序列化类对象

剑指 Offer 68 - I. 二叉搜索树的最近公共祖先

Code Interview Guide for Programmers CD15 Generating an Array of Windowed Maximums
![[MySQL] 多表查询](/img/f0/c158750a5a84155ee82729daba2bb3.png)
[MySQL] 多表查询

Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers

About making a progress bar for software initialization for Qt

2022.7.26 模拟赛

PAT serie b write the number 1002

MySQL-数据定义语言-DDLdatebase define language

leetcode43 string multiplication
随机推荐
2022年超全的Android面经(附含面试题|进阶资料)
剑指 Offer 68 - II. 二叉树的最近公共祖先
Excuse me, only primary key columns can be queried using sql in table storage. Does ots sql not support non-primary keys?
Logitech Mouse Experience Record
Robot_Framework:常用内置关键字
2022.7.27好题选讲
Excel record of integer programming optimization model to solve the problem
MySQL-Data Definition Language-DDLdatebase define language
对话MySQL之父:一个优秀程序员可抵5个普通程序员
状态压缩dp
微信小程序获取手机号phonenumber.getPhoneNumber接口开发
ORACLE 实现另外一个用户修改包(package)
Challenge 52 days to memorize Peppa Pig (Day 01)
Causes and solutions of lock table
leetcode43 string multiplication
2022年湖南工学院ACM集训第六次周测题解
万字逐行解析与实现Transformer,并进行德译英实战(三)
剑指 Offer 68 - I. 二叉搜索树的最近公共祖先
Pyspark Machine Learning: Vectors and Common Operations
Code Interview Guide for Programmers CD15 Generating an Array of Windowed Maximums