Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWizardPage nextId() logic via MessageBox
Forum Updated to NodeBB v4.3 + New Features

QWizardPage nextId() logic via MessageBox

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 656 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Prof
    wrote on 25 Jun 2013, 00:04 last edited by
    #1

    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?

    1 Reply Last reply
    0

    1/1

    25 Jun 2013, 00:04

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved