diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-11-04 11:17:30 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-11-17 22:10:48 +0100 |
commit | 99c70de9a6943ed3f0a81be7b2a395f24ab567ba (patch) | |
tree | 0d912b8620c01770cb0e971506b9bfd033ff1373 /src/corelib/kernel/qcoreevent.h | |
parent | c94bcecb22bce80101de79f4b3c0aff143ff34b5 (diff) |
Add dedicated child and parent events for QWindow reparenting
When a QWindow is parented into another window, either via its constructor,
or via setParent(), we also update the QObject parent of the window. This
in turn sends ChildAdded and ChildRemoved events to the new and old parent
of the window, as well as ParentAboutToChange and ParentChange to the window
itself.
But at the point when these events are sent, the QWindow parent relationship
has not been fully established. We have not updated d->parentWindow, nor
have we propagated the parent relationship to the platform window.
This is problematic because clients can not use these events to react to
window parent changes synchronously. For example. trying to raise a child
window when added to a parent is not going to work, because at that point
the child window isn't a native child of the parent.
Instead of re-using the QObject events for QWindow, like QWidget does,
by delaying the events or sending them manually at a point when the
window parent relationship has been fully formed, we opt to add new
dedicated events.
Change-Id: I019c14eba444861f537e4f68ab3a82297f843cf7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/kernel/qcoreevent.h')
-rw-r--r-- | src/corelib/kernel/qcoreevent.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index e8e4b4bba6..5c52047122 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -286,6 +286,11 @@ public: DevicePixelRatioChange = 222, + ChildWindowAdded = 223, + ChildWindowRemoved = 224, + ParentWindowAboutToChange = 225, + ParentWindowChange = 226, + // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event |