Creating a new widget class over using a stackedWidget?
-
I'm a new QT user using QT for a personal project. I haven't found an answer to this question (maybe I'm asking incorrectly).
My project is broken down into several pages. The pages are related as data will be shared. My question is: should I always be using a StackedWidget, or are there cases where creating a new designer form class is better?
For now, I have opted for the latter option since each page will likely have a stackedWidget for their page-specific functionalities; I didn't want to make it messy and have too many stackedWidgets embedded into each other. Is this correct? What are the advantages/disadvantages here, given it's not an HMI type application with limited functionality?
-
Hi and welcome :)
should I always be using a StackedWidget, or are there cases where creating a new designer form class is better?
As often: it depends...
Do you want to have your widgets at the same place and showing only one at a time or do you want them to be next to each other (or in a new window) and showing/using multiple at once?
AQStackedWidget
is one of Qt's plenty container widgets... there are also widgets likeQTabWidget
or different Model/Views.
QStackedWidget
works like a book with pages... you can flip the pages in-place, but you can only see thecurrentWidget
.I didn't want to make it messy and have too many stackedWidgets embedded into each other
Multiple or cascading
QStackedWidgets
?!
Mh, that already sounds like bad design. Can't see why you need to do this, since you can simply add a new widget to the onlyQStackedWidget
.
There is no need to embed a newQStackedWidget
and fill it with content widgets... there might be some edge cases, where it could be viable, but I can't see a reason why you need to do this right now ;-)Since we know nothing about your app, you should develop a feeling for which design suits your app the best.
Is it more technical? like some simple inputs/outputs, controls and some processing going on in the background.
Or do you have some fancy, modern app in mind, with lots of toolbars, side widgets, menus etc.?using QT for a personal project.
Because of this, you are not limited and you can try out few things... if you have a more concrete sketch of your app feel free to ask again :)
Happy coding :)
-