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

Support QPixmap from C++ in QML

    XMLWordPrintable

Details

    • 564d58025e46c825ec763193767defd78f5e13a0

    Description

      The current solution for passing on a pixmap from c++ to the QML is QDeclarativeImageProvider. It is not clear why QDeclarativeImageProvider is required for a simple task. It is fairly common for models to pass icons per item. QML forces the user to create this "image scheme". A simple scheme like image://model/<row> doesn't work well for changing models. When rows are inserted/removed, the view will not requery all the items since data has not changed for the other items but now the items are shifted by one and the urls are thus different. The user is then forced to create a image://model/<unique-id>.

      QTBUG-11980 explains why this feature does not exist. Unfortunately, I don't understand what it means. It says "The Image::pixmap property should be removed since it inherently causes memory issues. If a pixmap is created in a Qt application, passed to QML/JavaScript, and then not released by the Qt application, the memory used by the pixmap is never properly released." This is just expected behavior, isn't it? Why is this a problem? A new documentation section devoting to explaining the problem and possible solutions would be nice.

      Ideally, return a QPixmap from C++ should just work out of the box.

      Attachments

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

        Activity

          People

            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            girish Girish Ramakrishnan
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes