PDA

View Full Version : Problems with custom wizard



_Dron_
28th January 2015, 07:55
Hello,
I have some problems with custom wizard.
On first page user enters some text in qlineedit. Than he presses Next. After that the wizard must make a query to MySQL, get data, check it and:
1. If data is good - set next page id (the value of id depends on data)
2. If data is bad - don't do anything, just stay on current page, so the user can correct text in qlineedit.

How to do it? Where and when wizard must make a query? I don't understand Qt wizard logic.
I saws examples in Qt, saw that I should override nextId() etc. But there is no examples when wizard takes data outside.

Lesiok
28th January 2015, 08:06
Override QWizardPage::validatePage method and return true if all is OK.

_Dron_
28th January 2015, 10:13
This function doesn't work, because it never called.
I attached a trivial project of wizard. What is wrong?

Lesiok
28th January 2015, 11:50
1. QWizardPage::validatePage is NOT const so FirstPage::validatePage() may not have attribute const.
2. Wizard::validateCurrentPage() is invalid (attribute const) and even unnecessary.