I have a QDialog
that was created with Qt::WA_DeleteOnClose
flag. When specific event happens I need to hide the dialog and restore it later upon another specific event. If I make a call to QWidget::hide()
the dialog object is deleted (due to WA_DeleteOnClose
) which doesn't work for me.
Unfortunately I can't unset/reset Qt::WA_DeleteOnClose
in runtime for certain technical reasons.
The question is: how do I effectively hide QDialog
so that it's not visible but still exists? I tried
QDialog* pDlg = ...;
QSizePolicy newSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
pDlg->setSizePolicy(newSizePolicy);
pDlg->setMinimumSize(0,0);
pDlg->resize(0,0);
but this didn't work. Might it be that I can move the dialog outside the desktop? Or...
I'm solely on Windows if it matters.
Thanks.