If you are working with QObject based objects, that are not "parentless" I personally still recommend new/delete just making sure the parent is set.
I use smartpointers for the "top" widgets/objects ie anything that doesn't have a parent, as well as any NON Qobject based pointers. For instance, all "ui" created classes, rather than a new/delete are smart pointers constructed during the construction of the actual widget/object. Scott -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Sensei Sent: Tuesday, April 9, 2013 8:22 AM To: [email protected] Subject: [Interest] Moving to smart pointers: recommendations Dear all, after years of new/delete, I am ready to give smart pointers a try. But I'm quite puzzled about their implementation after reading the awesome "tutorial" (*) by Thiago Macieira. As an example, I ask you guys some recommendations on practical examples. Let's say I am creating some QActions. Right now I'm using a QList<QAction*>, and in my destructor I delete them. Is here possible to use only a QPointer? If I'm dealing with my internal widgets in a QMainWindow, is it recommended a QSharedPointer? Thanks for clarifying these doubts! (*) http://blog.qt.digia.com/blog/2009/08/25/count-with-me-how-many-smart-pointer-classes-does-qt-have/ _______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
