When I delete the object the QPointer is pointing to, I check the value of the QPointer, and it is not NULL, but when I check its isNull function, it returns true.
And more strangely, when I do (!m_qpointer) it also returns true.
So how is this possible?
(!m_qpointer)returns true when you delete the object it is pointing to, because of this operator defined inqpointer.h:It returns the pointer it is guarding. If it has been deleted, then it will be null.
isNull()returns true if the pointer it is guarding is null:Now I'm not sure what do you mean by I check the value of the QPointer, and it is not NULL. Why should it be null? The
QPointerobject should still be a valid object even after deleting the pointer it is guarding.