Important: Please read the Qt Code of Conduct -

Override next button functionality in QWizardPage

  • 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:
    But that's only for indicate the order page in non-linear wizards.

    Some suggestion?


  • @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?

  • I've done this:

    This is my header file:

    class MachineNamePage: public QWizardPage {
        public slots:
            void selectOS(int OSSelected);
            void next();

    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()

  • I solve the problem using the 'validatePage' function.

    bool MachineNamePage::validatePage() {
        return true;

Log in to reply