Use QScopedPointer instead of new/delete
Change-Id: I0651ad0244c1b4d3126a1dd3304f247f92240ffa Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>bb10
parent
177577932e
commit
b3008f8e25
|
|
@ -41,6 +41,7 @@
|
|||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include <QScopedPointer>
|
||||
#if QT_CONFIG(process)
|
||||
# include <QProcess>
|
||||
#endif
|
||||
|
|
@ -500,14 +501,13 @@ void tst_QObject::connectSlotsByName()
|
|||
|
||||
void tst_QObject::qobject_castTemplate()
|
||||
{
|
||||
QObject *o = 0;
|
||||
QVERIFY( !::qobject_cast<QObject*>(o) );
|
||||
QScopedPointer<QObject> o;
|
||||
QVERIFY(!::qobject_cast<QObject*>(o.data()));
|
||||
|
||||
o = new SenderObject;
|
||||
QVERIFY( ::qobject_cast<SenderObject*>(o) );
|
||||
QVERIFY( ::qobject_cast<QObject*>(o) );
|
||||
QVERIFY( !::qobject_cast<ReceiverObject*>(o) );
|
||||
delete o;
|
||||
o.reset(new SenderObject);
|
||||
QVERIFY(::qobject_cast<SenderObject*>(o.data()));
|
||||
QVERIFY(::qobject_cast<QObject*>(o.data()));
|
||||
QVERIFY(!::qobject_cast<ReceiverObject*>(o.data()));
|
||||
}
|
||||
|
||||
void tst_QObject::findChildren()
|
||||
|
|
|
|||
Loading…
Reference in New Issue