[Interest] Managing memory with QObject*-models exposed to QML

Stephen Kelly steveire at gmail.com
Sun Jul 17 23:07:45 CEST 2016

Ola Røer Thorsen wrote:

> My worry here is that deleteLater() is sometimes still too soon for the
> QML engine to keep up, especially when there is a lot of things going on
> in the Quick scene.

Or if there is an animation for item removal.

> Could this be the case? If so, what is the rock-solid way to do this?

Instantiate the QObjects in QML so that the QML engine owns them. 

  delegate: Item {

    // MyObject has properties.
    // Instance deleted by the QML engine when no longer needed
    MyObject {
      id: obj
      data: model.structuredData

This is the kind of thing that I describe in my QtCon talk:




More information about the Interest mailing list