返回目录:
Qt QML专栏目录结构_qml 项目 目录-CSDN博客
★4.9 弹出类控件(Popup、Dialog、Drawer、Menu、ToolTip)
※Popup控件
我们在项目中一般叫做 Message Box。 弹出消息框。

| QtObject <-- Popup | ||
| 属性 | ||
| activeFocus : bool | ||
| anchors.centerIn : Item | 就一个定位属性!! | |
| availableHeight : real | ||
| availableWidth : real | ||
| background : Item | 设置背景 Popup窗口的背景项,可以自定义背景颜色、边框、阴影等。 | |
| bottomInset : real | ||
| bottomMargin : real | ||
| bottomPadding : real | ||
| clip : bool | ||
| closePolicy : enumeration | 定义Popup的关闭策略,如点击背景区域、按Escape键或外部父项点击时关闭。 The default value is Popup.CloseOnEscape | Popup.CloseOnPressOutside. 默认的关闭策略是失去焦点则关闭。 | |
| contentChildren : list<Item> | ||
| contentData : list<QtObject> | ||
| contentHeight : real | ||
| contentItem : Item | Popup中的内容显示区域,可以包含各种子元素和布局。 contentItem 与 background 是同样的效果。 就是一个附加属性,再添加一个Item对象,例如一个Rectangle。 | |
| contentWidth : real | ||
| dim : bool | 控制背景是否变暗。当模态或调暗的Popup窗口可见时,背景会变暗。控制非模态对话框背景色的设置与否。 | |
| enabled : bool | ||
| enter : Transition | 打开的时候,设置动画。 | |
| exit : Transition | 关闭的时候,设置动画。 | |
| focus : bool | ||
| font : font | ||
| height : real | ||
| horizontalPadding : real | ||
| implicitBackgroundHeight : real | ||
| implicitBackgroundWidth : real | ||
| implicitContentHeight : real | ||
| implicitContentWidth : real | ||
| implicitHeight : real | ||
| implicitWidth : real | ||
| leftInset : real | ||
| leftMargin : real | ||
| leftPadding : real | ||
| locale : Locale | ||
| margins : real | ||
| mirrored : bool | ||
| modal : bool | 模态属性。指示Popup是否为模态窗口。模态窗口会阻止用户与主界面交互,直到关闭。 一定需要关闭模态对话框,才可以操作后面的控件。 | |
| opacity : real | ||
| opened : bool | ||
| padding : real | Popup内容与边界之间的填充距离。 | |
| palette : palette | ||
| parent : Item | ||
| rightInset : real | ||
| rightMargin : real | ||
| rightPadding : real | ||
| scale : real | ||
| spacing : real | ||
| topInset : real | ||
| topMargin : real | ||
| topPadding : real | ||
| transformOrigin : enumeration | ||
| verticalPadding : real | ||
| visible : bool | 注意它的默认属性是false。也就是说创建了不会显示。 | |
| width : real | ||
| x : real | ||
| y : real | ||
| z : real | ||
| 附加属性 | Overlay.modal | 没听明白,他跟dim的联系。 |
| Overlay.modalless | ||
| Signals | void aboutToHide() | 在Popup即将隐藏之前发出。 |
| void aboutToShow() | 在Popup即将显示之前发出 | |
| void closed() | ||
| void opened() | ||
| Method | void close() | 调用这个函数,可以让Popup不显示。 |
| forceActiveFocus(enumeration reason) | ||
| void open() | 调用这个函数,可以让Popup显示出来。 | |
- 正常的父控件的Visible属性,可以控制子控件的是否可见。但Popup是个例外,Popup不会因为父控件Visible属性为false而不显示。
Popup的z顺序。Popup的z顺序,可以覆盖其他控件,因为是弹窗啊,也可以理解。Popup之间的Z顺序,他们自己也会排序。
