PDA

View Full Version : QWizard noob question



Ossi
2nd September 2009, 10:15
Hi all.

I am making a wizard, and i want to use the last page to sum up all the information. But I cant get it to work.

I use registerField() to "collect" the data, but I cant get the data from the field unless I override the accept() function. i.e I can only get the data when the user pushes the finished button...

Some how I have to get all the user data without using the accept funktion.

The idea is that the user should verify all inputed data on the last page, if there is a error the user should be able to pres the back button and correct the error.

How can I do this?

victor.fernandez
2nd September 2009, 10:34
You can use QWizard::field(). Connect currentIdChanged() to a slot where you check if the current page is the last one and then get the field values to validate them.

Ossi
2nd September 2009, 11:37
How would you connect currentIdChanged() to a slot ? can you make a small example?

victor.fernandez
2nd September 2009, 11:45
Are you subclassing QWizard or using it from another class?


connect(m_wizard, SIGNAL(currentIdChanged(int)),
this, SLOT(mySlot()));

Ossi
2nd September 2009, 11:47
Ahhh a noob mistake... I forgot the int in currentIdChanged(). Thanks! It works now.

Ossi
2nd September 2009, 12:30
I found another solution. By reimplementing void QWizardPage::initializePage () [virtual], you can prepare the page before it is shown.

http://doc.trolltech.com/4.5/qwizardpage.html#initializePage