PDA

View Full Version : Changing a window like a QWizard



Momergil
29th November 2011, 14:28
Hello!

I'm planning a software that, in the same QMainWindow, should appear 3 completely different "group of things" (sorry, I couldn't find any better word ^^) and the change should be done by pressing a QComboBox. So for example when the software is initialized, a kind of window is shown, with some QWidgets, QPushButtons, some graphs and so forth. When the user changes the QComboBox, all this items mentioned should hide and other items should appear, such as a QTable, QGroupBox, etc..

Now technically this is like a QWizard application: one button changes the entire window. But "A wizard's purpose is to guide the user through a process step by step. ", and that's not my point. I don't want a guide, such as those software installers, but only the possibility to change the window as I want.

Some time ago I did a software that had a similar feature, but the changing was only a pair of QPushButtons and the window was small. So I only used a process of hide() and show() functions that did the job quite well.

But this time I'm working with a complete QMainWindow with lots of items, and to use hide() and show() would be "noisy" and I also want to use the Ui interface to make things easier, so there is no way I'm going to write down all the initializations and positionings of all of my itens in this series of hide() and show() (if this is the unique way, I would prefer to change to a QTabWidget, but I want to use this option only in last case.)

Is there a way for doing this? Can I, let us say, create 3 Forms and add the 3 to a unique MainWindow.cpp/MainWindow.h and than change the Ui when needed? Or is there another way? Or should I use QWizard anyway?


Thanks!!

Momergil

Added after 1 33 minutes:

Obs.: I noticed that I can put all the content in a QWidget and than use hide() and show() only to that widget. But in that case I would still have to create lots of things inside the .cpp file without the use of the Ui interface.

Oleg
29th November 2011, 14:29
Look at QStackedLayout or QStackedWidget.

Momergil
30th November 2011, 19:56
Look at QStackedLayout or QStackedWidget.

Thanks very much!


Momergil