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

AnimatedImage: setting sourceSize.width or height alone doesn't work

    XMLWordPrintable

Details

    • 4c21f7283 (dev), 3924c945d (dev)

    Description

      In https://codereview.qt-project.org/c/qt/qtdeclarative/+/447861 the test only checks setting a string like "80x60". But for SVG images it's quite normal to set width or height alone:

      sourceSize.width: 123
      

      So I think this should be ok for AnimatedImage too.

      The reason is to make the image fit into a layout or into a window while allowing it to retain its natural aspect ratio, even if you are switching images, or don't know the original size until you read it. You might want this in a gallery using GridView for example: each delegate wants to be square, but it also wants to have the image fill the height, and avoid distorting it; so maybe you set sourceSize.height and then center it horizontally, and set clip: true on the delegate. (Actually, qtdoc/examples/demos/photosurface/photosurface.qml should probably do this too, to save memory, but in that case any aspect ratio is fine, as long as it's preserved.)

      Attachments

        1. qtbug-115039.qml
          0.7 kB
          Shawn Rutledge
        2. miller.gif
          129 kB
          Shawn Rutledge

        Issue Links

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

          Activity

            People

              studiosus Vladimir Belyavsky
              srutledg Shawn Rutledge
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes