PDA

View Full Version : Multi-page application with Qt Designer



chiruL
23rd January 2016, 04:15
Hi, am totally newbie in gui programming using Qt.
I know how to create a single page program using the Qt Designer, but how can I create a multi page application ?
I've watched a ton of tutorials but they all only show how to create a single page application...

I want to create an application which will have a combo box with options "Hello" and "Bye". The combo box is in top of the main window.
When I select the "Hello" option on combo box, a "Hello World" push button will appear on the bottom of the main window.
When I select the "Bye" option on combo box, a "Bye World" push button will appear on the bottom of the main window(and the "Hello" button and all other stuff except the combo box must disappear).
So, basically, the content of the main window depends on which option is checked on the combo box.

How can I do that using the Qt Designer ?

(I'm using Qt4, PyQt and QT Designer)

anda_skoa
23rd January 2016, 10:08
You use a QStackedWidget as part of your top level UI. Then you put the different page UIs into it.
Then you connect the combobox's currentIndexChanged signal to the stackwidget's setCurrentIndex slot.

Cheers,
_