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

Add a way to preserve aspect ratio when setting Image.sourceSize

    XMLWordPrintable

Details

    • d95178153a0f15991b2e6e91216dbcf5c0be2af3

    Description

      Image.sourceSize is not keeping the aspect ratio when setting both width and height. The resulting image is shown as stretched, although setting the fillMode to PreserveAspectCrop.

      Example code:

      {{

      }}
      import QtQuick 1.0
      Item {
      Image {
          width: 200
          height: 200
          fillMode: Image.PreserveAspectCrop
          source: "http://labs.qt.nokia.com/wp-content/uploads/2011/08/menus.png"
          sourceSize.width: 300
          sourceSize.height: 300
      }
      }
      {{

      }}

      Is related to QTBUG-19185

      I would like to set sourceSize.usage = SourceCropped to tell the system that the size of the resulting image should preserve aspect ratio and the resulting sourceSize should be so that it either the sourceSize.width is the given width or the sourceSize.height is the given height, which ever results in a larger source image. SourceFitted would result in the smaller source image, although I can't understand, where this could be used...

      Currently, if the source image's both width and height are more than the given ones, it is like giving Stretch, and t

      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)
            alhannin Aleksi Hänninen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes