#include class MyWidget : public QWidget { Q_OBJECT public: MyWidget(QWidget *parent = 0) : QWidget(parent) { QVBoxLayout *vbox = new QVBoxLayout; setLayout(vbox); QTimer::singleShot(5000, this, SLOT(addWidget())); } public slots: void addWidget() { layout()->addWidget(new QLineEdit); } protected: void resizeEvent(QResizeEvent *e) { if (e->spontaneous()) qDebug("Catch"); } }; #include "main.moc" int main(int argc, char **argv) { QApplication a(argc, argv); MyWidget w; w.show(); return a.exec(); }