Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-87105

Layouts: add a way to specify exactly where to align a control

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Reported
    • Priority: P1: Critical
    • Resolution: Unresolved
    • Affects Version/s: 6.0.0
    • Fix Version/s: 6.1
    • Component/s: Quick: Controls 2
    • Labels:
      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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              smd Jan Arve
              Reporter:
              richard Richard Moe Gustavsen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes