PopupWindow QML 类型
一个由应用程序用于在 sysui 中显示模态弹出窗口的窗口。 更多...
| 从 | Qt 5.11 |
| 继承自 |
属性
- originItemX : real
- originItemY : real
- popupY : real
详细说明
Neptune 3应用程序的弹出窗口 显示在中央控制台。此组件使应用程序能够在系统 UI 中以系统模态弹出窗口的形式创建包含任何自定义内容的弹出窗口。
示例用法
//DevicesListPopup.qml
PopupWindow {
id: root
property var deviceModel
Item {
id: popupContent
anchors.fill: parent
Label {
id: headerText
text: "Please choose device"
}
ListView {
id: deviceList
model: root.deviceModel
delegate: RadioButton {
.....
}
.....
}
}
}
//DevicesMenu.qml
Item {
id: root
Button {
id: button
text: "Choose Device"
onClicked: {
var pos = button.mapToItem(root, button.width/2, button.height/2);
devicesListPopup.originItemX = pos.x;
devicesListPopup.originItemY = pos.y;
deviceListPopup.visible = true;
}
}
......
DevicesListPopup {
width: 910
height: 500
id: devicesListPopup
}
}应用程序的定制弹出窗口组件应继承自PopupWindow。也就是说,定制弹出窗口应该在将使用它的文件中实例化,而负责打开它的元素应设置其 originItemX、originItemY、宽度、高度,然后通过将可见属性设置为 true 请求显示它,如示例所示。
属性文档
originItemX : real |
此属性存储调用弹出窗口的项的 x 位置。它在 PopupItem 中内部使用以触发转换动画。
originItemY : real |
此属性存储调用弹出窗口的项的 y 位置。它在 PopupItem 中内部使用以触发转换动画。
popupY : real |
此属性存储弹出窗口的 y 位置。
©2019 Luxoft Sweden AB。本文件中包含的文档贡献为各自所有者的版权。
提供的文档许可采用自由软件基金会发布的 GNU 自由文档许可证版本 1.3 的条款。
Qt 和相应的徽标是芬兰 Qt 公司和/或其他国家/地区的商标。所有其他商标均为其各自所有者的财产。