PDA

View Full Version : Close window on close()



trust88
3rd May 2013, 09:13
I have a QWidget object, with a cancel button connected to a cancelClicked() slot. this slot is doing a widget->close(). Earlier, when i create this widget, I also set attribute:
this->setAttribute(Qt::WA_DeleteOnClose) ;.

On click on cancel, the most part of the widget closes, but it remains an ugly header (or ribbon if you prefer), with on the left the words "Form" and on the right a cross to close the widget. If i click on the cross, this ribbon disappears.

Do you know how to programmatically delete this ribbon as well ?

Thanks

Santosh Reddy
3rd May 2013, 16:55
One quick try would to hide() the widget before close().

As such the problem appears to do someting with QWidget parent/child relationship of the ribbon widget. I guess you are implmenting a custom QWidget with custom ribbon (and or other widget on it), make sure the widgets are properly assigned with proper parent.