A window overlay for popups. 更多...
import 语句: | import QtQuick.Controls |
继承: |
Overlay provides a layer for popups, ensuring that popups are displayed above other content and that the background is dimmed when a modal or dimmed popup is visible.
The overlay is an ordinary Item that covers the entire window. It can be used as a visual parent to position a popup in scene coordinates.
The following example uses the attached Overlay.overlay property to position a popup in the center of the window, despite the position of the button that opens the popup:
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 } }
另请参阅 ApplicationWindow .
Overlay.modal : Component |
This attached property holds a component to use as a visual item that implements background dimming for modal popups. It is created for and stacked below visible modal popups.
The property can be attached to any popup.
For example, to change the color of the background dimming for a modal popup, the following code can be used:
Popup { id: popup width: 400 height: 400 modal: true visible: true Overlay.modal: Rectangle { color: "#aacfdbe7" } }
另请参阅 Popup::modal .
Overlay.modeless : Component |
This attached property holds a component to use as a visual item that implements background dimming for modeless popups. It is created for and stacked below visible dimming popups.
The property can be attached to any popup.
For example, to change the color of the background dimming for a modeless popup, the following code can be used:
Popup { id: popup width: 400 height: 400 dim: true visible: true Overlay.modeless: Rectangle { color: "#aacfdbe7" } }
另请参阅 Popup::dim .
Overlay.overlay
:
Overlay
|
This attached property holds the window overlay item.
The property can be attached to any item, popup, or window. When attached to an item or a popup, the value is
null
if the item or popup is not in a window.
pressed () |
This attached signal is emitted when the overlay is pressed by the user while a popup is visible.
The signal can be attached to any item, popup, or window. When attached to an item or a popup, the signal is only emitted if the item or popup is in a window.
注意:
相应处理程序是
onPressed
.
released () |
This attached signal is emitted when the overlay is released by the user while a popup is visible.
The signal can be attached to any item, popup, or window. When attached to an item or a popup, the signal is only emitted if the item or popup is in a window.
注意:
相应处理程序是
onReleased
.