Remove usage of QWeakPointer for QObject
This usage of QWeakPointer has been deprecated since Qt 5.0, since it
leads to really confusing API - usually you must never dereference a
QWeakPointer directly, but always go through QSharedPointer, except in
this one case, where it's permissible.
Use QPointer instead, which is clean.
Only keep the QPointer where the object in question may get deleted,
while in the API where it has to be valid, use a regular pointer.
Initializing the pointer explicitly to nullptr makes no sense.