Qstackedwidget list of used widgets
-
Hi there,
I am wondering if it is possible to get a list of used widgets (and their names) stocked in a qstackedwidget. Exactly like when you are in QtCreator and you press Ctrl+tab (it shows the list of the last used files and put it in order). If yes, what is the best approach to realise it please?Thanks.
-
Yes,
What you need is QStackedWidget::count() and
QStackedWidget::widget() -
Hi (1+1=2), thanks for your reply. I know it's been a while, sorry for it.
But I have another question.
The documentary says that count() "holds the number of widgets contained by this stackedwidget". Sorry but I really don't get it. Does it mean that if I use count() inside a widget it will display the number of widgets my qstackedwidget has? And for widget() it will display me the name of the widget at the given index?! -
Well, you quoted the doc yourself: holds the number of widgets contained by this stacked widget, this means that the QStackedWidget knows how many widgets are stacked in it, no matter if you are inside or outside of your widget.
About QStackedWidget::widget, it gives you a pointer on the i-th widget (or zero if there is no such widget) -
Hi guys, sorry but I have other questions:
the doc mentions that widgets inside the qstackedwidget are part of an internal list and that each one receives an index position. But whenever the current widget changes a signal is emitted. Does it mean that the internal list updates itself and consequently the index position for each widget changes too? And why does this signal needs to be emitted?
I really need clarifications on it please.