Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [Solved] Using nextId() in linear wizard

    General and Desktop
    1
    3
    1297
    Loading More Posts
    • 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.
    • D
      donitaroid last edited by

      I'm trying to create a linear wizard like this.

      @
      this->setPage(Page_First, new PageReport());
      this->setPage(Page_Second, new PageSetting());
      ....
      this->setPage(Page_Final, new PageResult());
      @

      Each pages in my wizard is added by using setPage(), which allow us to set the page ID

      I want to display the string "show result" on the next button in all wizard pages. I use the following source to achieve this goal, but it failed.

      @
      if (Page_Final == nextId()) {
      setButtonText(QWizard::NextButton, QString("show result"));
      }
      @

      I checked the return value of nextId(). It always gives me -1. I know that I didn't implement the nextId() but I want to know which page would be the next. Can I get the next page ID in a linear wizard without implementing nextId()? Thank you

      1 Reply Last reply Reply Quote 0
      • D
        donitaroid last edited by

        I know there are many alternatives to replace the text on the next button. But I want to use these pages to create many different wizards with different purposes. I don't want to take care with the page order or which page is the next. I just want to know "is the next page have the page ID Page_Final?"

        Thanks again.

        1 Reply Last reply Reply Quote 0
        • D
          donitaroid last edited by

          I figured out why nextId() always returns -1. The reason is that I was using the nextId() in the constructor. Before the QWizardPage being inserted into QWizard, QWizard has no reason to know which page is the next page of current page.

          It's a stupid mistake. Sorry for disturbance.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post