Page provides five virtual functions that can be reimplemented to provide custom behavior:

initializePage() is called to initialize the page's contents when the user clicks the wizard's Next button. If you want to derive the page's default from what the user entered on previous pages, this is the function to reimplement.

cleanupPage() is called to reset the page's contents when the user clicks the wizard's Back button.

validatePage() validates the page when the user clicks Next or Finish. It is often used to show an error message if the user has entered incomplete or invalid information.

nextId() returns the ID of the next page. It is useful when creating non-linear wizards, which allow different traversal paths based on the information provided by the user.

isComplete() is called to determine whether the Next and/or Finish button should be enabled or disabled. If you reimplement isComplete(), also make sure that completeChanged() is emitted whenever the complete state changes.

Normally, the Next button and the Finish button of a wizard are mutually exclusive. If isFinalPage() returns true, Finish is available; otherwise, Next is available. By default, isFinalPage() is true only when nextId() returns -1. If you want to show Next and Final simultaneously for a page (letting the user perform an "early finish"), call setFinalPage(true) on that page. For wizards that support early finishes, you might also want to set the HaveNextButtonOnLastPage and HaveFinishButtonOnEarlyPages options on the wizard.

In many wizards, the contents of a page may affect the default values of the fields of a later page. To make it easy to communicate between pages, QWizard supports a "field" mechanism that allows you to register a field (e.g., a QLineEdit) on a page and to access its value from any page. Fields are global to the entire wizard and make it easy for any single page to access information stored by another page, without having to put all the logic in QWizard or having the pages know explicitly about each other. Fields are registered using registerField() and can be accessed at any time using field() and setField().

Property Documentation

The subtitle is shown by the QWizard, between the title and the actual page. Subtitles are optional. In ClassicStyle and ModernStyle, using subtitles is necessary to make the header appear. In MacStyle, the subtitle is shown as a text label just above the actual page.

[virtual] void QWizardPage::initializePage()

This virtual function is called by QWizard::initializePage() to prepare the page just before it is shown either as a result of QWizard::restart() being called, or as a result of the user clicking Next. (However, if the QWizard::IndependentPages option is set, this function is only called the first time the page is shown.)

By reimplementing this function, you can ensure that the page's fields are properly initialized based on fields from previous pages. For example:

bool QWizardPage::isCommitPage() const

[virtual] bool QWizardPage::isComplete() const

This virtual function is called by QWizard to determine whether the Next or Finish button should be enabled or disabled.

The default implementation returns true if all mandatory fields are filled; otherwise, it returns false.

If you reimplement this function, make sure to emit completeChanged(), from the rest of your implementation, whenever the value of isComplete() changes. This ensures that QWizard updates the enabled or disabled state of its buttons. An example of the reimplementation is available here.

Creates a field called name associated with the given property of the given widget. From then on, that property becomes accessible using field() and setField().

Fields are global to the entire wizard and make it easy for any single page to access information stored by another page, without having to put all the logic in QWizard or having the pages know explicitly about each other.

If name ends with an asterisk (*), the field is a mandatory field. When a page has mandatory fields, the Next and/or Finish buttons are enabled only when all mandatory fields are filled. This requires a changedSignal to be specified, to tell QWizard to recheck the value stored by the mandatory field.

QWizard knows the most common Qt widgets. For these (or their subclasses), you don't need to specify a property or a changedSignal. The table below lists these widgets:

To consider a field "filled", QWizard simply checks that their current value doesn't equal their original value (the value they had before initializePage() was called). For QLineEdit, it also checks that hasAcceptableInput() returns true, to honor any validator or mask.

[virtual] bool QWizardPage::validatePage()

This virtual function is called by QWizard::validateCurrentPage() when the user clicks Next or Finish to perform some last-minute validation. If it returns true, the next page is shown (or the wizard finishes); otherwise, the current page stays up.

The default implementation returns true.

When possible, it is usually better style to disable the Next or Finish button (by specifying mandatory fields or reimplementing isComplete()) than to reimplement validatePage().