PDA

View Full Version : How to change between QMainWindows???



webquinty
15th October 2009, 21:02
Hello,

I have two forms (UI's) and main.cpp load form1.
Now in form1.cpp I have a botton to load form2 and close form1.

classForm2 *form2 = new classForm2();
form2->show();
form1->close();

Well, If I execute this code, it works fine, but there is a small problem, after close form1 class, appear green background screen and later, form2 is loaded.

My question is, is it possible to avoid this behaviour???

Best regards.

Lykurg
15th October 2009, 21:09
Are you really talking of two QMainWindows? Then closing the first and showing the second is no good idea, because there should be only one QMainWindow in your application. If you just want to have other widgets on the screen you might should a look at QStackedWidget (e.g.).

wysota
15th October 2009, 21:31
Then closing the first and showing the second is no good idea, because there should be only one QMainWindow in your application.
That's not true, you can have as many of them as you want - it's a normal window like any other.

But this doesn't change the fact we probably don't know what green screen is the author of this thread talking about...

webquinty
16th October 2009, 10:46
Thanks a lot.

I am going to read Qt documentation about this class.

Best regards