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

馋奶兔 提交于 2020-08-06 11:41:18

问题


I have some objects created in QML code with

Qt.createQmlObject (...)

How can I delete/remove these objects?


回答1:


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



回答2:


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).



来源:https://stackoverflow.com/questions/16025962/qml-how-to-delete-an-objects-created-with-qt-createqmlobject

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!