Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    Unsolved How to go back 2 Wizardpages on a QWizard

    General and Desktop
    qwizard qwizardpa button
    2
    6
    2706
    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.
    • R
      roseicollis last edited by

      Hi again! I'm back with my QWizard and its QWizardPAges...

      I have the next pages for example: WP1 > WP2 > WP3 > WP4 Bien WP1 the first and WP4 the last one, my question is the next:
      If user is in WP3 and hits the Back button, it has to go to WP1, never WP2 again.... but I can't achieve this... how should I do the QWizard Back Button make that in that case¿?

      Thank you so much

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        One thing you could try is to use you own back button using QWizard::setButton and connect it to a slot where you can handle that use case by setting the nextId to one and call next by hand.

        Hope it helps

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        R 1 Reply Last reply Reply Quote 0
        • R
          roseicollis @SGaist last edited by

          @SGaist said:

          One thing you could try is to use you own back button using QWizard::setButton and connect it to a slot where you can handle that use case by setting the nextId to one and call next by hand.

          Sorry for the late reply but something more important came before... This is my code:

          connect(wizard(), SIGNAL(customButtonClicked(int)),this, SLOT(GoBackToMenu(int)));
          wizard()->button(QWizard::CustomButton1)->setText(QString::fromUtf8("Back")); 
          wizard()->button(QWizard::CustomButton1)->setVisible(true);
          
          void WPConfigs12::GoBackToMenu(int i)
          {
              if (i==6) // i =6 is custombuttton1
              {
                  wizard()->next();
              }
          }
          

          And then, ofc as wizard has already met the 2 WP back I need to do something like:

          bool BaseWizard::validateCurrentPage()
          {
              qDebug() << " estoy en validatecurrentpage back() " ;
          
              if( currentPage() == page( WP3) )
              {
                  if( ! currentPage()->validatePage() )
                 {
                      while( currentPage() != page( WP1) )
                      {
                           back();
                      }
                      return( false );
                  }
                  return( true );
             }
          }
          

          Normally this one works fine for me but this time does something strange:

          I start in WP1, then show WP2 (the one I want to hide when doing Back), and then show WP3.
          After that I click Back and it goes PERFECTLY to WP1 (which is the behaviour I am looking for) BUT if I click next again then it does: WP1>WP2>WP1 and if I click next again it does: WP1>WP2>WP3>WP2>WP3>WP2 >WP2....

          so.. any idea about how to go back and not having those problems?
          Thank you!

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            I was thinking more about an adaptation of the Non Linear Wizard example

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            R 1 Reply Last reply Reply Quote 0
            • R
              roseicollis @SGaist last edited by

              @SGaist Well, what I have is this type of 'non linear' wizard.. in fact I started with that example :D But I don't get how should I do it... If you say it for the BaseWizard::validateCurrentPage() then I don't know how to do it with other way.... could you please explain me what you are thinking more exactly? Thanks!

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                I was thinking about reimplementing nextId so that when you click on the "Back" button you reroute to the page you want then call next()

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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