#ifndef __SOMEDIALOG_H__ #define __SOMEDIALOG_H__ #include #include #include #include class SomeDialog : public QDialog { Q_OBJECT public: SomeDialog( QWidget *parent = Q_NULLPTR ) : QDialog( parent ) { QBoxLayout *l = new QVBoxLayout( this ); l->addWidget( new QLineEdit( this ) ); QPushButton *btn = new QPushButton( "exec", this ); l->addWidget( btn ); connect( btn, &QPushButton::clicked, this, &SomeDialog::onExec ); } ~SomeDialog() {}; public slots: void onExec() { QDialog *d = new SomeDialog( this ); d->exec(); } }; #endif // __SOMEDIALOG_H__