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

Row/Column layout has unexpected effect on Image's sourceSize

    XMLWordPrintable

Details

    • 695a39410c8ce186a2ce78cef51093c55fc32643

    Description

      Run the code below. Note how sourceSize.width is first 49 then changes immediately to zero. Drag the blue rect and note how sourceSize.height is correctly reported as 57. Drag the blue rect up and left past the top corner and note how the sourceSize.width is reported as increasingly negative values and never returns to larger values. If the Row is replaced with a Column then the same effect can be seen on sourceSize.height.

      include QtQuick 1.0
      Rectangle {
          width: 800
          height: 640
      
          Row {
              anchors.top: parent.top
              anchors.left: parent.left
              anchors.bottom: blueHandle.top
              anchors.right: blueHandle.left
      
              Image {
                  id: iconImage
                  anchors.top: parent.top
                  anchors.bottom: parent.bottom
                  source: "testIcon.png"
                  onHeightChanged: print("sourceSize.height: " + sourceSize.height)
                  onWidthChanged: print("sourceSize.width: " + sourceSize.width)
                  fillMode: Image.PreserveAspectFit
                  smooth: true
              }
          }
      
          Rectangle {
              id: blueHandle
              color: "blue"
              width: 25
              height: 25
              MouseArea {
                  anchors.fill: parent
                  drag.target: blueHandle
              }
          }
      }
      

      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)
            mathiasm Mathias Malmqvist
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes