[Qt-qml] Temporary QML Objects

michael.brasser at nokia.com michael.brasser at nokia.com
Thu May 27 07:26:55 CEST 2010


On 27/05/2010, at 10:01 AM, ext Colin Kern wrote:
> and then in a slot in my C++:
> QDeclarativeComponent component(view->engine(), QUrl("Effect.qml"));
> QObject *myObject = component.create();
> 
> this probably isn't the right way to go about this, but I'm not sure
> what is.  When I run this code, I don't see the Effect elements, but I
> do get debug messages saying "Effect.qml:10: Error: Invalid attempt
> to destroy() an indestructible object".

There are also several functions for dynamically creating components/objects from QML (http://doc.qt.nokia.com/4.7-snapshot/qdeclarativedynamicobjects.html). If you are able to create your objects from QML rather than C++ you shouldn't have any problems with destroying them.

Regards,
Michael





More information about the Qt-qml mailing list