Priority: P2: Important
Affects Version/s: 5.13.0
Fix Version/s: None
Component/s: Quick: Core Declarative QML
Software set up:
Have a treeview and create a Loader component in the treeview's itemDelegate, bind an Image component to the Loader's sourceComponent. The Image component is set to get the source from an image provider. And width and height is set to the Image component. Aslo, populates the treeview with some nodes with children.
Hardware set up:
The Windows machine should be connected to two different screens with different DPIs (or have different scale factor in Windows settings).
Steps to reproduce:
- Observe the image on the rows in the treeview.
- Expand one of the nodes and makes some of nodes on the bottom go out of view.
- Collapse the expanded node and brings back the out of view nodes.
- Observe the image on the rows that just re-entered the view.
The size of image is changed and not match the (Image size defined in qml, including the scale factor)
The size of image is consistent
100% of the time.
Stepped through part of the Qt source code and we found that Qt is trying to load the Image component and tries to get the pixmap from the image provider before the item is assigned to the window on step 3 of the reproduction steps. In this case it failed to retrieve the correct scale factor as the window is invalid. So it falls back to use the largest scale factor from the connected screens and this behavior changes the requestedSize to the image provider and changed final Image size on the screen.
I have two screens connected, screen one has a scale factor of 1.0, the other one is 1.25. I have set the Image component's size to (14,12) and get the application displayed on screen one. On the application start up, the requestedSize to the image provider is (14,12) which is perfect. Then when I do the reproduction steps, the requestedSize to the image provider is (18,15) which is (14,12) times the scale factor from the other screen.