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:
- If it has an image: url, the image is loaded through the image provider
- Otherwise, if QTextureFileReader::canRead() the url, it is loaded through a QSGTextureReader
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
- relates to
-
QTBUG-98958 Image sourceClipRect has no visual effect on an image from QQuickImageProvider
- Closed
Gerrit Reviews
For Gerrit Dashboard: QTBUG-86316 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
440141,3 | Pass the sourceClipRect setting in the QQuickImageProvider options | dev | qt/qtdeclarative | Status: MERGED | +2 | +1 |