Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2, 6.1.2
-
None
Description
Summary
Customization went wrong. Popup/Overlay is poorly compatible with ApplicationWindow layout model.
Description
Overlay, such as modal or modeless component of a Popup's overlay stretches to a whole window's size by default. But suppose you want a blurry background. For that you gonna need to capture all the window's content as a source for FastBlur effect (or any other blur for that matter). But there's no Item in ApplicationWindow which spans the whole window! There's contentItem, header, footer and even a menu bar, but those are all different things — although positioned strictly on top of each other. You can't just use contentItem: blurry image would "jump" and stretch relative to its source, if any other aforementioned item is present.
Workaround
Here is what I came up with.
1. Let's call contentItem, header, footer and menuBar collectively "root items of a window".
2. Use ShaderEffectSource type to capture every root item.
3. Set ShaderEffectSource dimensions to match their sources' dimensions.
4. Wrap each ShaderEffectSource in a Loader, because any of the root items may be null, except maybe contentItem (unless app is doing something extraordinarily dumb).
5. Stack them all in a Column.
6. Set that Column as a source for blur effect.
Also, there is a background property which I completely forgot about. Maybe it should be captured too.
Preferred solution
Either add a common (real) root Item to an ApplicationWindow, or make windows a "special case" for effects' sources.
Alternatives
Actually, there is QtQuick.Window::Window.contentItem base class property which is supposed to hold "The invisible root item of the scene". Unfortunately, using it as a source either does nothing at all, or leads to a black background — depending on which item do you use as a holder of an attached property. For example, popup.Window.contentItem is null at all times in Overlay.modal component's context; while page.Window.contentItem is genuinely QQuickRootItem, but does nothing.
Attachments
Issue Links
- relates to
-
QTBUG-122962 Bindings on Overlay's size and position are not respected
- In Progress