Hide pages in Stacked Widget
Solved
General and Desktop
-
Hi
The page is just a widget so it can be hidden as such BUT
it still exits in its list and as far as i know, it wont skip over them
when u set setCurrentIndex(int index)
So if u need various pages at different times, i think you have to use
void QStackedWidget::removeWidget(QWidget *widget)
to truly hide it.Is this some kind of Wizard ?
-
You have full control over which page is shown when you call setCurrentIndex(). So if you have, for example, some "Next" button which activates next page, you can implement "hiding" like this:
void on_next_clicked() { int i = stack->currentIndex(); i++; if (i == 5) { // Oh! I want to skip page with index 5 i++; } stack->setCurrentIndex(i); }