On Thu, May 5, 2016 at 3:24 AM, Nikos Chantziaras <rea...@gmail.com> wrote:
> > By now, I consider application-level code that uses 'new' or 'delete' as > bogus and in need of fixing. This line of thought doesn't work at all with Qt. It's just how it is done <http://doc.qt.io/qt-5/object.html>. If you are in such dire need of guaranteeing the absence of memory problems : template<typename T, typename... Args> auto make_qobject(Args&&... args, QObject* parent) // Repeat for QGraphicsItem / Object if necessary { assert(parent); return new T{std::forward<Args>(args)..., parent}; } QMainWindow win; auto safe_obj_1 = make_qobject<QListWidget> (&win); auto safe_obj_2 = make_qobject<QGridView>(&win);
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest