QWizardPage nextId() logic via MessageBox
-
Hi, I customized the wizard given in "License Wizard Example":http://qt-project.org/doc/qt-4.8/dialogs-licensewizard.html for my needs. I want to pop up a QMessageBox to ask the user a question, and based on that Yes/No, return the next QWizardPage to open.
I changed the relevant page's nextId() function with a basic QMessageBox and switch-case:
@int RegisterPage::nextId() const
{
QMessageBox addHaz;
addHaz.setText("Hazard Saved.");
addHaz.setInformativeText("Do you want to add another hazard?");
addHaz.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
addHaz.setDefaultButton(QMessageBox::No);
addHaz.setButtonText( QMessageBox::Yes, "Add Hazard" );
addHaz.setButtonText( QMessageBox::No, "Continue" );
switch( addHaz.exec() ) {
case QMessageBox::Yes:
return NewAssWiz::Page_Register;
break;
case QMessageBox::No:
return NewAssWiz::Page_Details;
break;
}}@
The problem I'm encountering now is that the QMessageBox pops up every time I click a button in the wizard on any page, including the back button, any button that uses Id logic to open a page. The correct pages are opened on every click, it's ignoring the return-value from the switch-case when it should.
Where should I implement the QMessageBox for it to only open on the one Page_Register?