Knight of Ni
Knight of Ni

Reputation: 1830

QML: How to delete an objects created with Qt.createQmlObject?

I have some objects created in QML code with

Qt.createQmlObject (...)

How can I delete/remove these objects?

Upvotes: 7

Views: 12867

Answers (2)

QtRoS
QtRoS

Reputation: 1177

Take a look at this article: Dynamic Object Management in QML and on this part especially:

Note that it is safe to call destroy() on an object within that object. Objects are not destroyed the instant destroy() is called, but are cleaned up sometime between the end of that script block and the next frame (unless you specified a non-zero delay).

Upvotes: 3

Megamozg
Megamozg

Reputation: 1063

something = Qt.createQmlObject (...);
something.destroy();

Upvotes: 9

Related Questions