当前位置:网站首页>QML type: overlay
QML type: overlay
2022-07-06 09:11:00 【Friendly, friend】
One 、 describe
overburden . by Popup Provides a layer , Make sure Popup Show on top of other content , And when modal or dimmed Popup The background darkens when visible .
Overlay is a common layer that covers the entire window Item. It can be used as a visual parent to locate in scene coordinates Popup.
The following example uses additional Overlay.overlay Property will be Popup Locate in the center of the window :
Button {
onClicked: popup.open()
Popup {
id: popup
parent: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: 100
height: 100
}
}
Two 、 Additional attribute members
1、Overlay.modal : Component
This additional property contains a component , This component is used as an implementation Modality Popup Visual items with darkened background . It is for the visible mode Popup Create and stack below it .
This attribute can be attached to any Popup .
for example , To change the mode Popup The background darkens , You can use the following code :
import QtQuick.Window
import QtQuick.Controls
ApplicationWindow {
id: window
width: 400
height: 400
visible: true
Button {
text: "Open"
onClicked: popup.open()
}
Popup {
id: popup
x: 100
y: 100
width: 200
height: 300
modal: true
focus: true
Overlay.modal: Rectangle {
color: "#800000ff"
}
}
}
2、Overlay.modeless : Component
This additional property contains a component , This component is used as an implementation Modeless Popup The visible item of background dimming . It is for visible dimming Popup Create and stack below it .
This attribute can be attached to any Popup .
for example , To change the background darkening color of the modeless pop-up window , You can use the following code :
Popup {
id: popup
x: 100
y: 100
width: 200
height: 300
focus: true
dim: true // essential
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
Overlay.modeless: Rectangle {
color: "#800000ff"
}
}
3、Overlay.overlay : Overlay
This attribute can be attached to any Item、Popup or Window.
3、 ... and 、 Additional signal members
1、pressed()
When the user Popup When you press the stack layer when it is visible , This additional signal will be sent .
2、released()
When the user Popup When the stack layer is released when it is visible , This additional signal will be sent .
边栏推荐
- Chapter 1 :Application of Artificial intelligence in Drug Design:Opportunity and Challenges
- 五层网络体系结构
- LeetCode:39. 组合总和
- Selenium+Pytest自动化测试框架实战(下)
- Reids之删除策略
- LeetCode:34. Find the first and last positions of elements in a sorted array
- Detailed explanation of dynamic planning
- Li Kou daily question 1 (2)
- 如何正确截取字符串(例:应用报错信息截取入库操作)
- [daily question] Porter (DFS / DP)
猜你喜欢
数学建模2004B题(输电问题)
[oc foundation framework] - < copy object copy >
Detailed explanation of dynamic planning
What is MySQL? What is the learning path of MySQL
requests的深入刨析及封装调用
Pytest parameterization some tips you don't know / pytest you don't know
Post training quantification of bminf
Compétences en mémoire des graphiques UML
甘肃旅游产品预订增四倍:“绿马”走红,甘肃博物馆周边民宿一房难求
[MySQL] limit implements paging
随机推荐
[today in history] February 13: the father of transistors was born The 20th anniversary of net; Agile software development manifesto was born
[OC-Foundation框架]---【集合数组】
MySQL uninstallation and installation methods
After reading the programmer's story, I can't help covering my chest...
LeetCode:162. Looking for peak
BN folding and its quantification
LeetCode:劍指 Offer 42. 連續子數組的最大和
一篇文章带你了解-selenium工作原理详解
Selenium+Pytest自动化测试框架实战
一改测试步骤代码就全写 为什么不试试用 Yaml实现数据驱动?
UML diagram memory skills
[OC]-<UI入门>--常用控件的学习
【每日一题】搬运工 (DFS / DP)
Philosophical enlightenment from single point to distributed
Using C language to complete a simple calculator (function pointer array and callback function)
自定义卷积注意力算子的CUDA实现
[oc]- < getting started with UI> -- common controls - prompt dialog box and wait for the prompt (circle)
Leetcode: Sword Finger offer 42. Somme maximale des sous - tableaux consécutifs
UML圖記憶技巧
力扣每日一题(二)