Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Releasing in QObjectList-based model

$
0
0
Hello, In document “Using C++ Models with Qt Quick Views” I’ve found description of an QObjectList-based model, which mostly looks cool for easy usage when you need to provide some data into QML, except one thing that I cannot really understand: how such a list is supposed to be released? There is a reference to the example, where QObject’s are created without any parent explicitly specified: QList<QObject*> dataList; dataList.append(new DataObject("Item 1", "red")); dataList.append(new DataObject("Item 2", "green")); dataList.append(new DataObject("Item 3", "blue")); dataList.append(new DataObject("Item 4", "yellow")); And also there is no any explicit destruction of the objects in this list. I’ve checked the whole example and put debug messages into DataObject destructor – it does not called at all. So my question is: Is Qt Quick engine responsible for such a model releasing (by deleting of each object in a list), or it is developer responsibility to make sure that everything is properly released? Can it be that example code contains mistake that is widely reproduced by other developers in their projects? Thanks for answers.

Viewing all articles
Browse latest Browse all 4972

Trending Articles