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. Override next button functionality in QWizardPage
Forum Update on Tuesday, May 27th 2025

Override next button functionality in QWizardPage

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 2.0k 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.
  • C Offline
    C Offline
    Carlavilla
    wrote on 25 Nov 2017, 10:55 last edited by
    #1

    Hi,

    I want to make some things when the next or back button are pressed in a QWizardPage.
    But I don't know how to override the functionality of that buttons.

    I saw in the Qt Documentation page the function nextId: https://doc.qt.io/qt-5/qwizard.html#nextId
    But that's only for indicate the order page in non-linear wizards.

    Some suggestion?

    Thanks

    J 1 Reply Last reply 25 Nov 2017, 11:15
    0
    • C Carlavilla
      25 Nov 2017, 10:55

      Hi,

      I want to make some things when the next or back button are pressed in a QWizardPage.
      But I don't know how to override the functionality of that buttons.

      I saw in the Qt Documentation page the function nextId: https://doc.qt.io/qt-5/qwizard.html#nextId
      But that's only for indicate the order page in non-linear wizards.

      Some suggestion?

      Thanks

      J Online
      J Online
      JonB
      wrote on 25 Nov 2017, 11:15 last edited by JonB
      #2

      @Carlavilla
      Unless someone knows a better way, could you handle the QWizard::currentIdChanged(int id) signal?

      Or, if you have derived your own class from base QWizard (always a good idea), you can just override QWizard::next() --- maybe do your own stuff, then call base QWizard::next(), depending on what you want to do?

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Carlavilla
        wrote on 25 Nov 2017, 12:12 last edited by
        #3

        I've done this:

        This is my header file:

        class MachineNamePage: public QWizardPage {
            Q_OBJECT
        
            public:
                ......
            signals:
               ......
            public slots:
                void selectOS(int OSSelected);
                void next();
        
            protected:
        
            private:
                ......
        };
        

        This is my source file:

        MachineNamePage::MachineNamePage(QWidget *parent) : QWizardPage(parent) {
        ......
        }
        
        void MachineNamePage::next() {
            qDebug() << "Next";
        }
        

        But I don't know how to make the QWizardPage execute the code inside MachineNamePage::next()

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Carlavilla
          wrote on 25 Nov 2017, 13:51 last edited by
          #4

          I solve the problem using the 'validatePage' function.

          bool MachineNamePage::validatePage() {
          
              return true;
          }
          
          1 Reply Last reply
          0

          1/4

          25 Nov 2017, 10:55

          • Login

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