Does QWidget::setAttribute() work with QWidget child classes?
This is a purely theoretical question, no actual code to display (well, one line). If I create a class that inherits from QWidget, does .setAttribute() still work for it? Most importantly, does it work with WA_DeleteOnClose?
Code:
//...
(myWidget) potato;
potato.setAttribute(Qt::WA_DeleteOnClose);
//....
Will WA_DeleteOnClose summon the class' destructor or only QWidget's?
Re: Does QWidget::setAttribute() work with QWidget child classes?
this is a question you can answer yourself. Simply create a subclass and see if the d-tor is called:
Code:
{
Q_OBJECT
public:
MyWidget
(QWidget* parent
= 0) : QWidget(parent
) { setAttribute
(Qt
::WA_DeleteOnClose);
} ~MyWidget() { qDebug() << Q_FUNC_INFO; }
}
and now see the output and your question answered.