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

Image component with QQuickImageProvider can be loaded by Loader before it's assigned to a window and makes the display result inconsistent



    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.13.0
    • Fix Version/s: None
    • Labels:
    • Environment:
      Windows 10
    • Platform/s:



      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.

      Actual result:

      The size of image is changed and not match the (Image size defined in qml, including the scale factor)

      Expected result:

      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.

      For example:

      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.


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



            qt.team.quick.subscriptions Qt Quick and Widgets Team
            eriche Eric He
            0 Vote for this issue
            2 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes