Qt-interest Archive, July 2007
QPointer question
Message 1 in thread
I have a Form:
class StepListForm : public QWidget, public StepListFormClass
{
...
}
so declared:
QPointer<StepListForm> lpStepListForm;
When I close the form from my application (for istance with the click on
the form close button "X" ) lpStepListForm is set to NULL, but if I call
lpStepListForm->close() lpStepListForm isn't set to NULL. Why?
Thanks
Teo
--
[ signature omitted ]
Message 2 in thread
Hi,
matteo wrote:
> I have a Form:
>
> class StepListForm : public QWidget, public StepListFormClass
> {
> ...
> }
>
> so declared:
> QPointer<StepListForm> lpStepListForm;
>
> When I close the form from my application (for istance with the click on
> the form close button "X" ) lpStepListForm is set to NULL, but if I call
> lpStepListForm->close() lpStepListForm isn't set to NULL. Why?
You need to set the widget attribute Qt::WA_DeleteOnClose e.g.
lpStepListForm->setAttribute( Qt::WA_DeleteOnClose );
Tim
--
[ signature omitted ]
Message 3 in thread
Hi,
The coffee hasn't kicked in; I should have read your question more
closely also...
Ceruti Simone Matteo wrote:
> Ops, i forget to write that when I open the form i use:
>
> if (lpStepListForm.isNull())
> {
> lpStepListForm = new StepListForm(lpMainWindow);
> lpStepListForm->setWindowFlags(Qt::Dialog |
> Qt::MSWindowsFixedSizeDialogHint);
> lpStepListForm->setAttribute(Qt::WA_DeleteOnClose);
> lpStepListForm->move(nStepListFormX,nStepListFormY);
> lpStepListForm->show();
> }
> but the problem is present.
Is the call to close() returning false? Is the widget hidden after the
call to close(), but not deleted?
Tim
--
[ signature omitted ]