Awesome! Like spirit suggested, this is all it takes:
MyWidget
::MyWidget(QWidget *parent
) :{
setAttribute(Qt::WA_DeleteOnClose);
connect(deleteButton, SIGNAL(clicked()), this, SLOT(close()));
}
MyWidget::MyWidget(QWidget *parent) :
QWidget(parent)
{
QPushButton *deleteButton = new QPushButton(this);
setAttribute(Qt::WA_DeleteOnClose);
connect(deleteButton, SIGNAL(clicked()), this, SLOT(close()));
}
To copy to clipboard, switch view to plain text mode
The widget is also removed from its parent and the layout. It flickers a bit (why isn't double buffering kicking in?), but it's worth the simplicity.
Bookmarks