Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.7.3, 6.5.0 RC
-
None
Description
Run the code below, and click on the screen twice:
import QtQuick 1.1 Item { width: 640 height: 480 MouseArea { property bool clicedOnce: false anchors.fill: parent onClicked: { print("BEFORE") print("\timplicitWidth: " + image.implicitWidth + " (sourceSize.width is " + image.sourceSize.width + ")") print("\timplicitHeight: " + image.implicitHeight + " (sourceSize.height is " + image.sourceSize.height + ")") if(!clicedOnce) { print("Setting image width") image.width = image.implicitWidth/2; } else { print("Setting image height") image.height = image.implicitHeight/2; } clicedOnce = true; print("AFTER") print("\timplicitWidth: " + image.implicitWidth + " (sourceSize.width is " + image.sourceSize.width + ")") print("\timplicitHeight: " + image.implicitHeight + " (sourceSize.height is " + image.sourceSize.height + ")") print("") } } Image { id: image source: "stretchbench/images/testIcon.png" fillMode: Image.PreserveAspectFit } }
This results in the following output in the console:
BEFORE implicitWidth: 49 (sourceSize.width is 49) implicitHeight: 57 (sourceSize.height is 57) Setting image width AFTER implicitWidth: 49 (sourceSize.width is 49) implicitHeight: 28.5 (sourceSize.height is 28) BEFORE implicitWidth: 49 (sourceSize.width is 49) implicitHeight: 28.5 (sourceSize.height is 28) Setting image height AFTER implicitWidth: 49 (sourceSize.width is 49) implicitHeight: 28.5 (sourceSize.height is 28)
This seems wrong.
The correct output should be:
BEFORE implicitWidth: 49 (sourceSize.width is 49) implicitHeight: 57 (sourceSize.height is 57) Setting image width AFTER implicitWidth: 24.5 (sourceSize.width is 49) implicitHeight: 28.5 (sourceSize.height is 57) BEFORE implicitWidth: 24.5 (sourceSize.width is 49) implicitHeight: 28.5 (sourceSize.height is 57) Setting image height AFTER implicitWidth: 12.25 (sourceSize.width is 49) implicitHeight: 14.25 (sourceSize.height is 57)
Attachments
Issue Links
- relates to
-
QTBUG-115535 Can't always get a non-blurry image in all cases using QML Image
- Reported
-
QTBUG-109064 Image.sourceSize changes when loaded locally
- Reported
-
QTBUG-115039 AnimatedImage: setting sourceSize.width or height alone doesn't work
- Closed
-
QTBUG-122705 Drag.imageSource property should have hi-dpi support
- Closed
-
QTBUG-122711 QQuickImageProviderWithOptions::loadSize doesn't deal with options correctly
- Reported
Gerrit Reviews
For Gerrit Dashboard: QTBUG-17269 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
268105,13 | Add QQuickImage::originalSize() property | dev | qt/qtdeclarative | Status: NEW | 0 | 0 |