PDA

View Full Version : Non-typical and Non-linear wizard



kornicameister
29th December 2010, 20:59
I am developing an application which uses a wizard to add new item into the database
every step (page) is checked for errors such as
- vital input field is empty
- some internal condition are not true

the problem I am facing here looks like
- the first welcome page has an id equal to 0, and any next page has an id incremented by 1
- loading the wizard is always successful
- however the condition which should be checked when user tries to leave page id=1 is in fact being checked when entering page id=1 (when leaving welcome page)

it means that every conditon which shuld be checked when leaving is checked when entering the page

hope that is explained clearly

I am looking for the solution to solve this bug but I do not have any working one still.
I tried additional variable and so on...

BTW, to control flow of wizard I reimplemented nextID() method
and below I present some useful debug info which I obtained after opening the wizard.
"Wizard constructing"
0
0
It is weird for me that nextID() method had been called twice after wizard was loaded, as
"Wizard constructing" statement is produced by qDebug at the end of the constructor as control output for me

ChrisW67
29th December 2010, 21:38
- however the condition which should be checked when user tries to leave page id=1 is in fact being checked when entering page id=1 (when leaving welcome page)

Where and how have you coded these checks? It could be in QWizard::validateCurrentPage(), QWizardPage::validatePage(), or QWizardPage::isComplete() but it sounds like you might be trying to do it in in QWizard::nextId() or QWizardPage::nextId().

Edit: I had the method names a bit wrong.

kornicameister
29th December 2010, 21:46
Nice guess actually
there is an another time when doing certain things on fly increase amount of work very... very and so on to infitity
Yeah, you right about what I am trying to do, that's only because I'd not read the docs too carefully and failed to find these info (if there are included there)
I assume this functions to be virtual, so I will make sure about and reimplement it

for now thansk for pointing me to the right direction ;-)


ehmm... but I do not use QWizardPage separately, I created the whole wizard via QtCreator
but perhaps there is a smart way to perform such checks as You suggested

ChrisW67
29th December 2010, 23:00
All of the methods I mentioned are in the QWizard or QWizardPage docs in Assistant. (I have corrected one of the names above).

You can use Designer/Qt Creator to create QWizardPage classes and then use the promotion feature to put them into your QWizard.

kornicameister
30th December 2010, 15:26
And everythings worked just fine
thank You for Your help :)

so I assume than that my wizard is not so untypical as I'd thought :-)))))) what a shame :)