PDA

View Full Version : QWizard



rmagro
26th September 2008, 09:36
Hi guys,

I am working with Qwizard..
I noticed that it is not possible to visit a page that has already been visited..

Is it really like this?

If not, which is the way to re-call from a later step a page which has been visited a step before..

Thank you

spirit
26th September 2008, 09:43
doesn't this slot QWizard::back (http://doc.trolltech.com/4.4/qwizard.html#back) work?

rmagro
26th September 2008, 09:57
It works, but I don't want to get to one page back but to a page visited some steps before
(I was trying to use
return SampleWizard::Page_XYZ;

spirit
26th September 2008, 10:06
try to set needed page using void setStartId ( int id ) and then call
void restart () :D

rmagro
26th September 2008, 10:21
it does not work..
maybe be it is not possible to do so..

Indeed In qtwizard.cpp is:

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);
}
}

rmagro
26th September 2008, 10:23
we would need something to set tha a certain page has not been visited!!even if it is not true..

is there ??

spirit
26th September 2008, 10:38
so, I know this is a trick (:D), but I managed to go to needed page


LicenseWizard::LicenseWizard(QWidget *parent)
: QWizard(parent)
{
setPage(Page_Intro, new IntroPage);
setPage(Page_Evaluate, new EvaluatePage);
setPage(Page_Register, new RegisterPage);
setPage(Page_Details, new DetailsPage);
setPage(Page_Conclusion, new ConclusionPage);

setStartId(Page_Intro);

#ifndef Q_WS_MAC
setWizardStyle(ModernStyle);
#endif
setOption(HaveHelpButton, true);
setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo.png"));

connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));
QAbstractButton *b = this->button(QWizard::BackButton);
connect(b, SIGNAL(clicked()), this, SLOT(goToSecondPage()));

setWindowTitle(tr("License Wizard"));
}

void LicenseWizard::goToSecondPage()
{
setStartId(Page_Evaluate);
restart();
}

rmagro
26th September 2008, 15:29
Sorry Spirit but this way you get the secondPage each time you press back button, right?

spirit
26th September 2008, 21:41
yup, but I just wanted to show that it is possible. :)