aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindowmodule.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-09-27 11:04:48 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-11-13 16:48:13 +0000
commit02c98b7590b060430dc5ce7e5821fa13087d25f7 (patch)
treea0296bb82bbc4b09c19ea5611113e8fb0b2c83c4 /src/quick/items/qquickwindowmodule.cpp
parent6fc15fa0a5ef55fbbdf7c8f66f50125a148fbea7 (diff)
Register Window.transientParent, track user-code overriding
When QtQuick "magically" guesses the transient parent relationship from nesting of declarations, it calls QWindow::setTransientParent(), which has been public C++ API all along. Now there is a new transientParent property; the setter is QWindowPrivate::setTransientParent(), which sets a flag. If the flag tells us that user code (e.g. QML) has set the transientParent property, we assume the user is overriding the magic, and we can also allow user code to set the window visible immediately, rather than waiting for its transient parent to become visible. Task-number: QTBUG-67903 Task-number: QTBUG-52944 Change-Id: Ia4d303263d387931d2051b2a950694a48ad5e541 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/quick/items/qquickwindowmodule.cpp')
-rw-r--r--src/quick/items/qquickwindowmodule.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp
index ab3f49d5b6..2b109c0897 100644
--- a/src/quick/items/qquickwindowmodule.cpp
+++ b/src/quick/items/qquickwindowmodule.cpp
@@ -124,7 +124,8 @@ void QQuickWindowQmlImpl::componentComplete()
Q_D(QQuickWindowQmlImpl);
d->complete = true;
QQuickItem *itemParent = qmlobject_cast<QQuickItem *>(QObject::parent());
- if (itemParent && !itemParent->window()) {
+ const bool transientParentAlreadySet = QQuickWindowPrivate::get(this)->transientParentPropertySet;
+ if (!transientParentAlreadySet && itemParent && !itemParent->window()) {
qCDebug(lcTransient) << "window" << title() << "has invisible Item parent" << itemParent << "transientParent"
<< transientParent() << "declared visibility" << d->visibility << "; delaying show";
connect(itemParent, &QQuickItem::windowChanged, this,
@@ -210,6 +211,9 @@ void QQuickWindowModule::defineModule()
qmlRegisterUncreatableType<QQuickScreen,1>(uri, 2, 3, "Screen", QStringLiteral("Screen can only be used via the attached property."));
qmlRegisterUncreatableType<QQuickScreenInfo,2>(uri, 2, 3, "ScreenInfo", QStringLiteral("ScreenInfo can only be used via the attached property."));
qmlRegisterUncreatableType<QQuickScreenInfo,10>(uri, 2, 10, "ScreenInfo", QStringLiteral("ScreenInfo can only be used via the attached property."));
+ qmlRegisterRevision<QWindow,13>(uri, 2, 13);
+ qmlRegisterRevision<QQuickWindow,13>(uri, 2, 13);
+ qmlRegisterType<QQuickWindowQmlImpl,13>(uri, 2, 13, "Window");
}
QT_END_NAMESPACE