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

Image sourceClipRect ignored for textures, "image:" urls

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.0
    • Fix Version/s: None
    • Labels:
      None

      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

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            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