1

I have a QWizard with 2 custom buttons (on top of the Back\Next buttons).

I wish that a click on my custom button will change to another QWizardPage.

How do I do that? Thanks

RanH
  • 740
  • 1
  • 11
  • 31

1 Answers1

2

That would be doable by connecting the custom buttons clicked signal with a slot which handles moving to next page.

QWizard wizard;

wizard.setButtonText(QWizard::CustomButton1, "Custom button");
wizard.setOption(QWizard::HaveCustomButton1, true);

QObject::connect(&wizard, &QWizard::customButtonClicked, [&]
{
    wizard.next();
});

The code above would create a wizard with a custom button which would function like the default "next" button. If you want to create a dynamic (as opposed to linear wizard which it is by default) you would need to reimplement QWizard::nextId(). Please see:

https://doc.qt.io/qt-5/qwizard.html#nextId

miped
  • 36
  • 1