QMainWindow swap Central Widget or QStackedWidget
-
I have the following Situation:
A Widget of type A which is like a Dialog. Which can only get accepted.
A Widget of type B which runs the main application
A Widget of type C which reports the Outcome of the main widget. It is also like a Dialog with the choice to start a new B or quit the program.
So my program flow is :
Display A.
A gets accepted.
Display B
B-> finnishes.
Dsiplay C (show the result of B)Have the option to start again a new B (Some aspects of B are random so it has to get created new everytime we switch back).
I was wondering how to organize the flow of the programm the best?
-
Putting them in a
QMainWindow
and changecentralWidget
?
-> I tryed this approach it seems to work but A and C don't follow the size rules since they are based onQDialog
. So in Short evrytime I switchcentralWidget
the QMainWindow jumps to annother place and resizes. Even withsetFixedSize
-
Or use
QStackedWidget
and get the old B and C out at the time to replace them with new ones? -
Annother option im not aware off.
I hope you can push me in the right direction here.
-
-
Hi,
Why do you need to put them out of the stacked widget ?
Implement them so that you can refresh/reset them so you only have one instance of each and be done with it.