PDA

View Full Version : two forms in main one after the other one?



ferdna
20th October 2011, 19:43
what do i do so when newForm1 closes the other one (newForm2) shows...



#include <QtGui/QApplication>
#include "newForm1.h"
#include "newForm2.h"

int main( int argc, char *argv[] )
{
QApplication app( argc, argv );

newForm1 n;
n.show();

newForm2 w;
w.show();

return app.exec();
}

stampede
21st October 2011, 00:07
Reimplement closeEvent() in newForm1, emit custom "closed()" signal there and connect it to "show()" slot in newForm2 (don't call "show()" on newForm2 instance in that case).
Another way, make newForm1 derived from QDialog, and use exec() instead of show().