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 Updated to NodeBB v4.3 + New Features

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.
  • CarlavillaC Offline
    CarlavillaC Offline
    Carlavilla
    wrote on 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

    JonBJ 1 Reply Last reply
    0
    • CarlavillaC Carlavilla

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on 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
      • CarlavillaC Offline
        CarlavillaC Offline
        Carlavilla
        wrote on 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
        • CarlavillaC Offline
          CarlavillaC Offline
          Carlavilla
          wrote on last edited by
          #4

          I solve the problem using the 'validatePage' function.

          bool MachineNamePage::validatePage() {
          
              return true;
          }
          
          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