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

Image sourceClipRect ignored for textures, "image:" urls

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.0
    • None
    • 967997d93 (dev)

    Description

      The new sourceClipRect property for Image, introduced in 5.15.0, does not work for "image:" urls or texture files.

      In QQuickPixmap::load(), whether synchronous (createPixmapDataSync()) or not (QQuickPixmapReader::processJob()), there end up being three possible paths the image can be loaded through:

      1. If it has an image: url, the image is loaded through the image provider
      2. Otherwise, if QTextureFileReader::canRead() the url, it is loaded through a QSGTextureReader
      3. Otherwise, it is loaded through QImageReader::read()
         

      In the third case here, QImageReader::read() applies the sourceClipRect by copy()ing a portion of the image, if necessary (its handler might also handle the clipping itself). But in the other two cases, the QQuickPixmap resolves with the full (unclipped) image.
       
      As a workaround, the Image item can be wrapped in another item with clip: true. Then the width and height of the wrapper can be set to the desired clip rect size, and the x: and y: can be set to the negative of the clip rect origin.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-86316
          # Subject Branch Project Status CR V

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              russell_zahniser Russell Zahniser
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes