summaryrefslogtreecommitdiff
path: root/src/quick
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/doc/snippets/qml/nestedWindowTransientParent.qml23
-rw-r--r--src/quick/doc/snippets/qml/windowActiveAttached.qml10
-rw-r--r--src/quick/items/qquickwindow.cpp22
3 files changed, 36 insertions, 19 deletions
diff --git a/src/quick/doc/snippets/qml/nestedWindowTransientParent.qml b/src/quick/doc/snippets/qml/nestedWindowTransientParent.qml
new file mode 100644
index 0000000000..51f076172d
--- /dev/null
+++ b/src/quick/doc/snippets/qml/nestedWindowTransientParent.qml
@@ -0,0 +1,23 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import QtQuick
+
+//![0]
+Window {
+ // visible is false by default
+ Window {
+ transientParent: null
+ visible: true
+ }
+//![0]
+
+ id: outer
+ Timer {
+ interval: 2000
+ running: true
+ onTriggered: outer.visible = true
+ }
+//![1]
+}
+//![1]
diff --git a/src/quick/doc/snippets/qml/windowActiveAttached.qml b/src/quick/doc/snippets/qml/windowActiveAttached.qml
new file mode 100644
index 0000000000..791091ef82
--- /dev/null
+++ b/src/quick/doc/snippets/qml/windowActiveAttached.qml
@@ -0,0 +1,10 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//![entire]
+import QtQuick
+
+Text {
+ text: Window.active ? "active" : "inactive"
+}
+//![entire]
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 6a0c405be3..4684fb291e 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -3496,17 +3496,8 @@ void QQuickWindow::endExternalCommands()
Item or Window within which it was declared, you can remove that
relationship by setting \c transientParent to \c null:
- \qml
- import QtQuick.Window 2.13
-
- Window {
- // visible is false by default
- Window {
- transientParent: null
- visible: true
- }
- }
- \endqml
+ \snippet qml/nestedWindowTransientParent.qml 0
+ \snippet qml/nestedWindowTransientParent.qml 1
In order to cause the window to be centered above its transient parent by
default, depending on the window manager, it may also be necessary to set
@@ -3568,14 +3559,7 @@ void QQuickWindow::endExternalCommands()
Here is an example which changes a label to show the active state of the
window in which it is shown:
- \qml
- import QtQuick 2.4
- import QtQuick.Window 2.2
-
- Text {
- text: Window.active ? "active" : "inactive"
- }
- \endqml
+ \snippet qml/windowActiveAttached.qml entire
*/
/*!