Qt Code: Switch view QWidget *Qw = new QWidget();
Qw->setAttribute(Qt::WA_DeleteOnClose, true);

qDebug() << testAttribute(Qt::WA_DeleteOnClose); // paranoid confirmation

Qw->close(); // At this point I can still access Qw without any errors

qDebug() << Qw->baseSize(); // pick any access function