MyForm::setWindowModality(Qt::WindowModal);
void MyForm::accept(){ setResult(1); close();}void MyForm::reject(){ setResult(0); close();}void MyForm::setResult(const int &newResult){ iResult = newResult;}
class MyForm: public QWidget{ Q_OBJECT Q_PROPERTY(int Result READ Result WRITE setResult)public: MyForm::MyForm(QWidget * parent); int Result() const {return iResult;}public slots: void accept(); void reject();private: int iResult; void setResult(const int &newResult);};
MyForm *MyDialog = new MyForm(this); MyDialog ->show(); if (MyDialog ->Result() == 1) //.....
void slotSmth(){ ... MyDialog * dialog = new MyDialog( this ); if( dialog->exec() ) { ... } else { ... } ... if( dialog ) delete dialog;}