diff options
| author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2025-12-11 16:27:43 +0100 |
|---|---|---|
| committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2025-12-18 23:33:00 +0100 |
| commit | f82676b96e778d9dc25bdaa72f6ff9bba2714b2b (patch) | |
| tree | c5b3363af262f0a3d4eb6a3e86d7ef5ebdefcd22 /doc/src/snippets/code/src_gui_qopenglshaderprogram.cpp | |
| parent | da9022d7abf8317b2cda47f10986b1e250d60d76 (diff) | |
macOS: Enable clipping of subviews when QWindow has child windows
QWindow::setParent() is documented to promise that the child window will
be clipped to its parent, which we rely on in e.g. Qt Widgets when a
native window is added to a scroll area.
As of macOS 14 (if the app is built against the 14+ SDK), the default
behavior changed from clipping to not clipping NSViews.
We now explicitly opt back into the behavior, but try to be smart
about it and only do it if we have potential child windows (since
our own drawing should be correctly clipped to the window bounds).
We could be even smarter and only consider QWindow based subviews,
but if so we need to also account for foreign windows, which are
not QNSViews.
It's a bit unfortunate that we have to enable the clipping as broadly
as this, as for e.g. WindowContainer in Qt Quick we use setMask to
handle child window clipping, but for now this at least restores the
behavior for Qt Widgets.
[ChangeLog][macOS] QWindows with child windows will now set the
NSView.clipsToBounds property to YES, to ensure that the child
windows are clipped to their parent.
Fixes: QTBUG-142664
Pick-to: 6.11 6.10 6.8 6.5
Change-Id: I352afcf1b664d29d928ac5b7e2c828ad757f28e7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'doc/src/snippets/code/src_gui_qopenglshaderprogram.cpp')
0 files changed, 0 insertions, 0 deletions
