summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-09-24 14:50:33 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-09-27 14:02:07 +0000
commit324e92200fc233d3c6c192856422b519814a03a8 (patch)
tree4858138f2e9c50e7a3bd2cafdfdb7d98d2ac8b9b /src/gui/kernel/qwindow.cpp
parent706db17d9af2c52e5b3c1c0b01ae52c1650d3c16 (diff)
Make QWindow::transientParent a property
The accessors have existed for a long time, but in Qt Quick it helps to have it available as a property, in case any of the "magic" guesses wrong about the user's intention. [ChangeLog][QtGui][QWindow] QWindow::transientParent is now a property. Task-number: QTBUG-67903 Task-number: QTBUG-52944 Change-Id: Ibf6ed789c4756bd934bdb4620fbcdb5879c3fb17 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r--src/gui/kernel/qwindow.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 3d7d22959d..17a18f3c9a 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1328,16 +1328,18 @@ Qt::WindowStates QWindow::windowStates() const
*/
/*!
- Sets the transient \a parent
+ \property QWindow::transientParent
+ \brief the window for which this window is a transient pop-up
+ \since 5.13
This is a hint to the window manager that this window is a dialog or pop-up
- on behalf of the given window.
+ on behalf of the transient parent.
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 call
setFlags() with a suitable \l Qt::WindowType (such as \c Qt::Dialog).
- \sa transientParent(), parent()
+ \sa parent()
*/
void QWindow::setTransientParent(QWindow *parent)
{
@@ -1354,19 +1356,28 @@ void QWindow::setTransientParent(QWindow *parent)
d->transientParent = parent;
QGuiApplicationPrivate::updateBlockedStatus(this);
+ emit transientParentChanged(parent);
}
-/*!
- Returns the transient parent of the window.
-
- \sa setTransientParent(), parent()
-*/
QWindow *QWindow::transientParent() const
{
Q_D(const QWindow);
return d->transientParent.data();
}
+/*
+ The setter for the QWindow::transientParent property.
+ The only reason this exists is to set the transientParentPropertySet flag
+ so that Qt Quick knows whether it was set programmatically (because of
+ Window declaration context) or because the user set the property.
+*/
+void QWindowPrivate::setTransientParent(QWindow *parent)
+{
+ Q_Q(QWindow);
+ q->setTransientParent(parent);
+ transientParentPropertySet = true;
+}
+
/*!
\enum QWindow::AncestorMode