How to determine QObject* is empty or not?
Unsolved
General and Desktop
-
I have tried
if(object != nullptr) { qDebug() << "test "; qDebug() << QString::fromStdString(event->source()->metaObject()->className()); }
it can enter the checking but I cannot get the className and it crashed on that line. Am I using the wrong method to determine the QObject*? Thank you.
-
@clementNg
you're checking, if the object is != nullptr, but than you do not use the object but the event.Shouldn't you rather check if event is valid?
-
@clementNg well, what is event ? can you show some more of your code?
-
@clementNg said in How to determine QObject* is empty or not?:
I dun know how to check the event too
If event is a pointer then you do it like you do for object...