#include <QApplication>
#include <QtGui>
int main(int argc, char** argv){
l->addWidget(b1);
l->addWidget(b2);
QObject::connect(b1,
SIGNAL(clicked
()), dlg,
SLOT(exec
()));
//here you can "play" with the show or exec to see the difference QObject::connect(b2,
SIGNAL(clicked
()),
&ap,
SLOT(quit
()));
QObject::connect(b3,
SIGNAL(clicked
()), dlg,
SLOT(close
()));
w->show();
return = ap.exec();
}
#include <QApplication>
#include <QtGui>
int main(int argc, char** argv){
QApplication ap(argc, argv);
QWidget *w = new QWidget(0);
QVBoxLayout *l = new QVBoxLayout(w);
QPushButton *b1 = new QPushButton("Open Dialog");
QPushButton *b2 = new QPushButton("Close");
l->addWidget(b1);
l->addWidget(b2);
QDialog *dlg = new QDialog(w);
QPushButton *b3 = new QPushButton("Close", dlg);
QObject::connect(b1, SIGNAL(clicked()), dlg, SLOT(exec())); //here you can "play" with the show or exec to see the difference
QObject::connect(b2, SIGNAL(clicked()), &ap, SLOT(quit()));
QObject::connect(b3, SIGNAL(clicked()), dlg, SLOT(close()));
w->show();
return = ap.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks