[Qt-interest] Memory Management in Qt
Konrad Rosenbaum
konrad at silmor.de
Tue Oct 26 08:28:41 CEST 2010
On Tuesday 26 October 2010, Ramesh wrote:
> What about the Qlistview and QStandardItemModel object?
> Should I delete them in the destructor of widget? Or any other
> alternative is there for it also?
The listview is owned by its parent widget - you do not need to delete it.
The QStandardItemModel takes an optional first parameter: the parent. If it
has a parent it will be deleted automatically when the parent is deleted. I
usually let models be owned by the same widget as the *view it is used by -
this way they are cleaned up together.
Konrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101026/f9ef2807/attachment.bin
More information about the Qt-interest-old
mailing list