Requesting an instance of a Qt object
3 answers
QObject *obj = 0;
// ...
if (!obj) obj = new QObject();
Note. Does not guarantee that obj
it is not a dangling pointer .
0
source to share
Use the class QPointer
. http://qt-project.org/doc/qt-4.8/qpointer.html#data
Whenever you call deleteLater();
it sets the value to 0 than you can check.
QPointer<QWidget> someWidget = 0;
0
source to share