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

边栏推荐
- Robot_Framework: Assertion
- About making a progress bar for software initialization for Qt
- Jupyter shortcuts
- pytorch、tensorflow对比学习—计算图和微分机制
- 剑指 Offer 68 - I. 二叉搜索树的最近公共祖先
- Pyspark Machine Learning: Vectors and Common Operations
- Swastika line-by-line parsing and realization of the Transformer, and German translation practice (a)
- Seleniu: Common operations on elements
- Qt Widget 项目对qml的加载实例
- Selenium:元素判断
猜你喜欢

对话MySQL之父:一个优秀程序员可抵5个普通程序员

小心你的字典和样板代码

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

Robot growth in China

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

WPF项目-初步了解数据绑定 binding

What should I do if the neural network cannot be trained?

中国的机器人增长

Qt Widget 项目对qml的加载实例

剑指 Offer 68 - II. 二叉树的最近公共祖先
随机推荐
万字逐行解析与实现Transformer,并进行德译英实战(二)
Selenium: Introduction
state compressed dp
MySQL-数据操作-分组查询-连接查询-子查询-分页查询-联合查询
uva10825
AspNet.WebApi.Owin 自定义Token请求参数
I met a shell script
vim配置+ctag像source insight一样方便阅读代码
解决浏览器滚动条导致的页面闪烁问题
WebSocket实现聊天功能
matplotlib pyplot
微信小程序用户登录auth.code2Session接口开发
【翻译】确保云原生通信的安全:从入口到服务网及更远的地方
零序电流继电器器JL-8C-12-2-2
The solution to the inconsistency between the PaddleX deployment inference model and the GUI interface test results
Robot_Framework:关键字
MySQL-DML语言-数据库操作语言-insert-update-delete-truncate
(2022 Niu Ke Duo School IV) N-Particle Arts (Thinking)
A,H,K,N
Code Interview Guide for Programmers CD15 Generating an Array of Windowed Maximums