Details
-
Task
-
Resolution: Unresolved
-
P1: Critical
-
6.0.0
-
None
Description
Layouts today use the outer geometry of the control/item for positioning them in a layout. But this is too coarse-grained. E.g when left-aligning a Button and a CheckBox, you want the left edge of the box to be at the exact left edge of the button. But depending on how the style draws a checkbox, the box itself (without the label) might be an image with some canvas/shadow. And when aligning, you typically don't want to align to e.g the left of the shadow. This is especially apparent for native styling where we use QStyle to draw native controls onto images. QStyle already has the concept of layoutRects, which we already forward to the QML control to e.g position focus frames etc.
So what we need is for layouts to have something like Layout.LeftOffset that can be set by the item/control to pixel position the layout perfectly.
As an optimisation, we should add a virtual function to QQuickItemPrivate (e.g virtual QMargins QQuickItemPrivate::layoutOffset()) that can be overridden by QQuickControlPrivate. If the item doesn't have an attached Layout object, the Layouts implementation instead call that function. We then override the function in QuickControlPrivate to forward some QQuickControl specific properties (e.g a new leftLayoutOffset etc) that can be set directly from the QML style control without the need to create an extra attached Layout object for each and every control.
Attachments
Issue Links
- relates to
-
QTBUG-83612 earmarked by richard
- Closed