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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.13.0
    • None
    • Windows 10
    • Windows

    Description

      Conditions:

      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

      Reproducibility:

      100% of the time.

      Notes:

      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.

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes