当前位置:网站首页>QML beginner
QML beginner
2022-07-07 16:58:00 【God port】
One 、 New projects
1. choice Qt Quick Application Empty
2. Name it QmlDemoa, Then all for the next step 
3. At this point, the project directory and demonstration effect 

Two 、 Create another component
1. choice QtQuick UI File
Wrong English type here :component1
2. The structure of the current project 
3. Design new qml We can directly use qml.ui Drag and drop design 
In this demonstration, I will add it in the form of code .
Generated in the project directory component.qml and component1.ui.qml In fact, both can be used ,qml You can call ui Any element in , If you are directly in ui Drag and drop , Will automatically generate code in ui.qml. Of course, our code can be written in any file , It's all about personal preference .
3、 ... and 、 Code
component1.qml
import QtQuick 2.4
Rectangle {
property alias mouseArea:mouseArea
property alias topRect:topRect//define the property name
width: 360
height: 360//set form's width and height
MouseArea{
id:mouseArea//name
anchors.fill: parent
}
//the first rectangle
Rectangle{
rotation:45//define the rotation angle
//set the position,size and color
x:40
y:50
width: 100
height: 100
color: "blue"
}
//the second rectangle
Rectangle{
id:topRect//id
opacity: 0.5
scale: 0.8 //scale the size
x:135
y:60
width: 100
height: 100
radius: 8
gradient: Gradient{
GradientStop{
position: 0.0;color:"yellow"}
GradientStop{
position:1.0;color: "red"}
}
border{
width: 3;color: "green"}
}
}
main.qml
import QtQuick 2.9
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Component1
{
}
}
Four 、 summary
such , A simple qml Application setup is complete , Component development is now a popular way of Internet , Once learned VUE3 Large scale application , The advantage is better coupling , It is convenient for later code maintenance , After all, the declaration cycle of a software program ,20% Time in development ,80% Time for maintenance .
5、 ... and 、 design sketch

demo Download address :https://download.csdn.net/download/qq_38491692/85448974
边栏推荐
- LeetCode 213. 打家劫舍 II 每日一题
- Three. JS series (2): API structure diagram-2
- ORACLE进阶(六)ORACLE expdp/impdp详解
- As an Android Developer programmer, Android advanced interview
- 字节跳动Android金三银四解析,android面试题app
- Opencv personal notes
- Talk about the realization of authority control and transaction record function of SAP system
- Imitate the choice of enterprise wechat conference room
- Binary search tree (features)
- AutoLISP series (3): function function 3
猜你喜欢

Temperature sensor chip used in temperature detector

Vs2019 configuration matrix library eigen

Imitate the choice of enterprise wechat conference room
正在准备面试,分享面经
最新高频Android面试题目分享,带你一起探究Android事件分发机制
![[designmode] proxy pattern](/img/ed/642aebc7b49cbf4d30b517665b2438.png)
[designmode] proxy pattern

网关Gateway的介绍与使用

The team of East China Normal University proposed the systematic molecular implementation of convolutional neural network with DNA regulation circuit

【DesignMode】外观模式 (facade patterns)

《产品经理必读:五种经典的创新思维模型》的读后感
随机推荐
【PHP】PHP接口继承及接口多继承原理与实现方法
Personal notes of graphics (4)
Lowcode: four ways to help transportation companies enhance supply chain management
LeetCode 1031. 两个非重叠子数组的最大和 每日一题
第九届 蓝桥杯 决赛 交换次数
Introduction to ThinkPHP URL routing
The latest interview experience of Android manufacturers in 2022, Android view+handler+binder
整理几个重要的Android知识,高级Android开发面试题
SqlServer2014+: 创建表的同时创建索引
Opencv configuration 2019vs
直接上干货,100%好评
Have fun | latest progress of "spacecraft program" activities
【C 语言】 题集 of Ⅹ
Set the route and optimize the URL in thinkphp3.2.3
掌握这个提升路径,面试资料分享
【MySql进阶】索引详解(一):索引数据页结构
Localstorage and sessionstorage
面试题 01.02. 判定是否互为字符重排-辅助数组算法
Prometheus API deletes all data of a specified job
typescript ts基础知识之tsconfig.json配置选项