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

very hard to reload QML Image

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Invalid
    • P2: Important
    • 5.1.0
    • 4.7.0
    • None
    • Qt 4.7

    Description

      I have a Image element in my QML, and I use my own ImageProvider as the source, my ImageProvider is a plugin.

      Image

      { Id: foregroundImage Source: "image://ownimageprovider/foreground sourceSize.width: mainWidget.imageWidth }

      My ownimageprovider generate dynamic QImage for Image element, but I don't know how to reload image when image is changed.

      I tried to use a stupid way to do: add sourceSize.width property. When I know image is changed from my c++ code, I emit "imageWidthChanged" signal(by increase image width to 1, or minus 1, human cannot see the difference if image size is changed 1 pixel), then image is reloaded. But this solution is not working all the time, only work in some times.

      Is there better and robust solution for this?

      --------------------------------------------------------------------
      Lam Bea's solution:

      There is no straightforward way to do this at the moment. The only way to force a reload would be to modify the image url to ensure a new image is requested from the image provider - for example, by appending some unique number that then is ignored by the image provider.

      Attachments

        Issue Links

          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
              jingzhe Jingzhe Yu
              Votes:
              14 Vote for this issue
              Watchers:
              20 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes