PDA

View Full Version : [Help]: How to make a QWizardPage unvisited?



dongli
30th June 2009, 08:18
Hi, everyone

I want to create a wizard with some kind of loop, so how to make a visited page unvisited?

Thanks for advance!

DONG Li

wysota
30th June 2009, 21:54
Take a look at QWizard::nextId(), it helps you create a non-linear wizard.

Neptilo
13th July 2014, 18:36
QWizard::nextId() doesn't allow to make loops, because as soon as you come back to a page you already visited, QWizard won't let you visit it again.

The source: qwizard.cpp (https://qt.gitorious.org/qt/qt/source/59eb561989f7a7b65c3e9b11d0ac062479013bf2:src/gui/dialogs/qwizard.cpp) explicitly shows that this is impossible:


void QWizard::next()
{
Q_D(QWizard);

if (d->current == -1)
return;

if (validateCurrentPage()) {
int next = nextId();
if (next != -1) {
if (d->history.contains(next)) {
qWarning("QWizard::next: Page %d already met", next);
return;
}
if (!d->pageMap.contains(next)) {
qWarning("QWizard::next: No such page %d", next);
return;
}
d->switchToPage(next, QWizardPrivate::Forward);
}
}
}

Has anyone got an idea of a way to force visiting a page, or to remove a page from the history, or to disable storing pages in the history? (Let's see if people still visit threads from 2009 ^^)

anda_skoa
13th July 2014, 19:41
Maybe calling back() until the current page is the one you want to return to?

Cheers,
_