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

QGraphicsAnchorLayout: Make fair distribution better when we have center anchors.

    XMLWordPrintable

Details

    Description

      Consider the following layout:

       // itemX has a minimum size of 50
       // itemA and itemB have minimum size of 15
      
       // a sequence A and B
       addAnchor(layout, Qt::AnchorLeft, itemA, Qt::AnchorLeft);
       addAnchor(itemA, Qt::AnchorRight, itemB, Qt::AnchorLeft);
       addAnchor(itemB, Qt::AnchorRight, layout, Qt::AnchorRight);
      
       addAnchor(itemX, Qt::AnchorLeft, itemA, Qt::AnchorHorizontalCenter);
       addAnchor(itemX, Qt::AnchorRight, itemB, Qt::AnchorHorizontalCenter);
      

      Should result in this layout:

      |                                                                                    |
      |     +------------+                                              +------------+     |
      |     | 15 30 60   |                                              | 15 30 60   |     |
      +-----+            +----------------------------------------------+            +-----+
      |     | itemA      |                                              | itemB      |     |
      |     +-----+------+                                              +------+-----+     |
      |           |                       +------------+                       |           |
      |           |                       | 50 70 90   |                       |           |
      |           +-----------------------+            +-----------------------+           |
      |                                   | itemX      |                                   |
      |                                   +------------+                                   |
      |                                                                                    |
      
      

      What would be the sizeAtMinimum for A and B for this layout? Today, A and B won't be simplified into the same sequence, and the problem will be fed to the simplex, risking that the simplex would distribute A:40 and B:60. (Assuming 0 spacing).

      The idea of adding anchors to ARBITRARY points in the item, not only the center can help fixing this issue.

      Attachments

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

        Activity

          People

            smd Jan Arve
            smd Jan Arve
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes