[Interest] QAbstractItemView and default QItemSelectionModel

Eric Clark eclark at ara.com
Mon Jun 25 23:12:25 CEST 2012


Hello All,

I have a curious question about the default QItemSelectionModel that is created whenever a QAbstractItemView is created: Is this default selection model parented to the view? What I really want to know is, if I create a new QAbstractItemView, set the model on it and then create a new QItemSelectionModel and pass it into the view's setSelectionModel() function, will the default selection model be deleted when the view is deleted? The documentation is a little hazy on this topic. It says that "It is up to the application to delete the old selection model if it is no longer needed...", but that it will be deleted by its parent if it has one. So, I have a new view and I am changing its selection model to my own and the one that was created by default is no longer needed. Should I go ahead and delete the old default selection model, or is it safe to say it is parented to the view and will be deleted when the view is deleted?

Thank You,
Eric

When you meet someone better than yourself, turn your thoughts to becoming his equal. When you meet someone not as good as you are, look within and examine your own self. -- The Analects, Confucius

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120625/41601912/attachment.html>


More information about the Interest mailing list