Best way to have multiple pyqt GUIs? First page determines inputs of second page?
-
I have a GUI that changes based on which version the user wants. For example the first page has the user enter if they want to look at cars or trucks, the second page then will have different characteristics of each. If the user hits car then it shows buttons for sedans, convertibles, etc. vs if the user hits trucks then it has options for truck beds and torque, etc. Initially I was creating the original GUI and then either hiding or showing certain characteristics based on the choice but that doesn't seem like the best way to go about this.
My question basically is, would it be better to have 3 separate pages? The intro page, the car page, and the truck page, and only show the specific page I want? Or would it be better to have one single page and hide or show specific options?
-
@poordev123 Take a look at https://doc.qt.io/qt-5/qstackedwidget.html
With that approach you would have different pages and show only one which is currently needed. -
Hi
I would use a QStackedWidget and have a full page for each item unless we talk about very minor
change in characteristics.
I would prefer a page for each due to:- Easier to maintain if you add new characteristics later
- More clean code not having to hide/show depending on the type and hence easier to reuse
say for preview for an orderlist
- Qt allows easy reuse of Widgets components so I can share a setup even across pages.
-
Its actually the same widget :)
Its perfect for designs with multiple pages, but only one visible at a time.