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. How to go back 2 Wizardpages on a QWizard
QtWS25 Last Chance

How to go back 2 Wizardpages on a QWizard

Scheduled Pinned Locked Moved Unsolved General and Desktop
qwizardqwizardpabutton
6 Posts 2 Posters 3.3k Views
  • 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 Offline
    R Offline
    roseicollis
    wrote on 10 Feb 2016, 16:23 last edited by
    #1

    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
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 10 Feb 2016, 23:59 last edited by
      #2

      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 29 Feb 2016, 17:13
      0
      • S SGaist
        10 Feb 2016, 23:59

        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

        R Offline
        R Offline
        roseicollis
        wrote on 29 Feb 2016, 17:13 last edited by
        #3

        @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
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 29 Feb 2016, 22:04 last edited by
          #4

          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 1 Mar 2016, 08:09
          0
          • S SGaist
            29 Feb 2016, 22:04

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

            R Offline
            R Offline
            roseicollis
            wrote on 1 Mar 2016, 08:09 last edited by
            #5

            @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
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 1 Mar 2016, 20:40 last edited by
              #6

              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
              0

              • Login

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