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

Anchor layout causes too many size changes

    XMLWordPrintable

Details

    • 051a76c1d65d698f71dc75c89f91ae9021357eae

    Description

      The snippet below shows the c.width changes multiple times. Changing width will trigger further changes in dependent components, and this is visible in performance (especially when constructing delegates for ListView). Problem was noticed when a delegate implementation was changed to use anchor layout (as suggested by QML performance tips page) instead of direct bindings, and the "fixed" delegate was slower than the original.

      import Qt 4.7
      
      Rectangle {
          width: 480
          height: 640
      
          Image {
              id: l
              source: "http://qt.nokia.com/logo.png"
              anchors.left: parent.left
              anchors.top: parent.top
              fillMode: Image.PreserveAspectFit
              asynchronous: false
              height: 40
              onWidthChanged: console.log("l.width " + width)
          }
      
          Rectangle {
              id: c
              anchors.left: l.right
              anchors.top: parent.top
              anchors.right:  r.left
              height: 40
              onWidthChanged: console.log("c.width " + width)
              color: "red"
          }
      
          Rectangle {
              id: r
              anchors.right: parent.right
              anchors.top: parent.top
              width: 40
              height: 40
              onWidthChanged: console.log("r.width " + width)
              color: "blue"
          }
      }
      

      Attachments

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

        Activity

          People

            martjone Martin Jones (closed Nokia identity) (Inactive)
            mikkohar Mikko Harju
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes