PDA

View Full Version : 2 Form in the project



Victor007
18th March 2013, 10:58
Hello! I work with Qt in Win7.

My question is how to manage two forms in one project. I've already did two forms and I can open and close the second form (Form2) with the button click on the first form (Form1). But I also need to open and close Form1 with the button on Form2. How can I do this?
I already have several reccomendations, like that:
1) In Form2 class:

signals:
void closeFirstForm();

2) In some method:
connect(frm2, SIGNAL(closeFirstForm()), frm1, SLOT(close()));


But I do not understand, how should I define variables frm1 and frm2 and what is exactly the method (button click on Form2 ?)

Thank's a lot for any help!

wysota
18th March 2013, 19:10
Either use a QStackedWidget or pass a pointer to the first form to the second form when you create it so that you can later invoke show() on it.