[Development] QScopedPointer and QObjects
Matt Broadstone
mbroadst at gmail.com
Sun Jul 28 19:51:13 CEST 2013
Hey all,
I've found more often than I'd like in my unit tests I'm writing a custom
deleter for QObjects when using a QScopedPointer. Something to the effect
of:
struct QObjectDeleter
{
static inline void cleanup(QObject *pointer) {
if (pointer)
pointer->deleteLater();
}
};
and then:
QScopedPointer<MyQObjectSubclass, QObjectDeleter> object;
Is there a reason this wasn't added for convenience? Or, would there be
interest in me submitting a patch to include this in a later version of Qt?
We should even be able to fix this seamlessly with templates unless I'm
mistaken.
Regards,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130728/57303d60/attachment.html>
More information about the Development
mailing list