PDA

View Full Version : How to significally change the itens in the same QDialog or QWidget



Momergil
6th September 2011, 21:53
Hello everybody!


I have a doubt about how efficiently change the layout of a QDialog or QWidget.

As you may know, there are some moments in which we want to complete change the buttons and lists and everything else in the same window. For example, normally when we are installing a software, a window appears with a first look, than you click "Next" and a complete different look appears, with new texts, widgets and buttons, than you may click "Next" once again, than other things appears, and so on till the moment when you say the last "OK" or "Cancel".

Now I know how to do that, but the say doesn't seems fine. Now what I do is to create a QGridLayout with all the buttons and labels and so forth, but in the moment that the window is shown, I use the hide() function in the undesirable items. When the "Next" button is clicked, everything that I do is to use hide() once again and show() in the other items, and so forth.

Is this right? Or is there a better way of doing this? I imagine that it would be better if I could create a different QGridLayout for each "page" of the window and each time the "next" button is clicked, it simple changes the layout.


So, does somebody knows a better idea or the "correct" way of doing this?


Thanks!


Momergil

ChrisW67
6th September 2011, 22:00
QWizard is almost exactly what your are describing