I have a widget W
deriving from QFrame
with layout set to an instance of QVBoxLayout
. I wonder if the following resizeEvent
implementation is correct or is it going to cause an infinite loop:
void W::resizeEvent(QResizeEvent *event) {
for (/* some condition based on the new size of this widget */) {
// Infinite loop or not?
qobject_cast<QVBoxLayout *>(layout())->addWidget(new QWidget());
}
}
So far it worked for me, is this by pure luck?
Aucun commentaire:
Enregistrer un commentaire