QWizard Class Reference

The QWizard class provides a framework for wizards.

  1. #include <QWizard>

Inherits: QDialog.

This class was introduced in Qt 4.3.

Detailed Description

The QWizard class provides a framework for wizards.

A wizard (also called an assistant on Mac OS X) is a special type of input dialog that consists of a sequence of pages. A wizard's purpose is to guide the user through a process step by step. Wizards are useful for complex or infrequent tasks that users may find difficult to learn.

QWizard inherits QDialog and represents a wizard. Each page is a QWizardPage (a QWidget subclass). To create your own wizards, you can use these classes directly, or you can subclass them for more control.

Topics:

A Trivial Example

The following example illustrates how to create wizard pages and add them to a wizard. For more advanced examples, see Class Wizard and License Wizard.

  1.                 QWizardPage *createIntroPage()
  2.  {
  3.     QWizardPage *page = new QWizardPage;
  4.     page->setTitle("Introduction");
  5.  
  6.     QLabel *label = new QLabel("This wizard will help you register your copy "
  7.                                "of Super Product Two.");
  8.     label->setWordWrap(true);
  9.  
  10.     QVBoxLayout *layout = new QVBoxLayout;
  11.     layout->addWidget(label);
  12.     page->setLayout(layout);
  13.  
  14.     return page;
  15. }
  16.  
  17. QWizardPage *createRegistrationPage()
  18.  {
  19.     ...
  20. }
  21.  
  22. QWizardPage *createConclusionPage()
  23.  {
  24.     ...
  25. }
  26.  
  27. int main(int argc, char *argv[])
  28.  {
  29.     QApplication app(argc, argv);
  30.  
  31.     QString translatorFileName = QLatin1String("qt_");
  32.     translatorFileName += QLocale::system().name();
  33.     QTranslator *translator = new QTranslator(&app);
  34.     if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
  35.         app.installTranslator(translator);
  36.  
  37.     QWizard wizard;
  38.     wizard.addPage(createIntroPage());
  39.     wizard.addPage(createRegistrationPage());
  40.     wizard.addPage(createConclusionPage());
  41.  
  42.     wizard.setWindowTitle("Trivial Wizard");
  43.     wizard.show();
  44.  
  45.     return app.exec();
  46. }

Wizard Look and Feel

QWizard supports four wizard looks:

You can explicitly set the look to use using setWizardStyle() (e.g., if you want the same look on all platforms).

ClassicStyle ModernStyle MacStyle AeroStyle

Note: AeroStyle has effect only on a Windows Vista system with alpha compositing enabled. ModernStyle is used as a fallback when this condition is not met.

In addition to the wizard style, there are several options that control the look and feel of the wizard. These can be set using setOption() or setOptions(). For example, HaveHelpButton makes QWizard show a Help button along with the other wizard buttons.

You can even change the order of the wizard buttons to any arbitrary order using setButtonLayout(), and you can add up to three custom buttons (e.g., a Print button) to the button row. This is achieved by calling setButton() or setButtonText() with CustomButton1, CustomButton2, or CustomButton3 to set up the button, and by enabling the HaveCustomButton1, HaveCustomButton2, or HaveCustomButton3 options. Whenever the user clicks a custom button, customButtonClicked() is emitted. For example:

  1.         wizard()->setButtonText(QWizard::CustomButton1, tr("&Print"));
  2.         wizard()->setOption(QWizard::HaveCustomButton1, true);
  3.         connect(wizard(), SIGNAL(customButtonClicked(int)),
  4.                 this, SLOT(printButtonClicked()));

Elements of a Wizard Page

Wizards consist of a sequence of QWizardPages. At any time, only one page is shown. A page has the following attributes:

The diagram belows shows how QWizard renders these attributes, assuming they are all present and ModernStyle is used:

When a subTitle is set, QWizard displays it in a header, in which case it also uses the BannerPixmap and the LogoPixmap to decorate the header. The WatermarkPixmap is displayed on the left side, below the header. At the bottom, there is a row of buttons allowing the user to navigate through the pages.

The page itself (the QWizardPage widget) occupies the area between the header, the watermark, and the button row. Typically, the page is a QWizardPage on which a QGridLayout is installed, with standard child widgets (QLabels, QLineEdits, etc.).

If the wizard's style is MacStyle, the page looks radically different:

The watermark, banner, and logo pixmaps are ignored by the MacStyle. If the BackgroundPixmap is set, it is used as the background for the wizard; otherwise, a default "assistant" image is used.

The title and subtitle are set by calling QWizardPage::setTitle() and QWizardPage::setSubTitle() on the individual pages. They may be plain text or HTML (see titleFormat and subTitleFormat). The pixmaps can be set globally for the entire wizard using setPixmap(), or on a per-page basis using QWizardPage::setPixmap().

Registering and Using Fields

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. It is also possible to specify mandatory fields (i.e., fields that must be filled before the user can advance to the next page).

To register a field, call QWizardPage::registerField() field. For example:

  1. ClassInfoPage::ClassInfoPage(QWidget *parent)
  2.     : QWizardPage(parent)
  3.  {
  4.     ...
  5.     classNameLabel = new QLabel(tr("&Class name:"));
  6.     classNameLineEdit = new QLineEdit;
  7.     classNameLabel->setBuddy(classNameLineEdit);
  8.  
  9.     baseClassLabel = new QLabel(tr("B&ase class:"));
  10.     baseClassLineEdit = new QLineEdit;
  11.     baseClassLabel->setBuddy(baseClassLineEdit);
  12.  
  13.     qobjectMacroCheckBox = new QCheckBox(tr("Generate Q_OBJECT &macro"));
  14.  
  15.     registerField("className*", classNameLineEdit);
  16.     registerField("baseClass", baseClassLineEdit);
  17.     registerField("qobjectMacro", qobjectMacroCheckBox);
  18.     ...
  19. }

The above code registers three fields, className, baseClass, and qobjectMacro, which are associated with three child widgets. The asterisk (*) next to className denotes a mandatory field.

The fields of any page are accessible from any other page. For example:

  1. void OutputFilesPage::initializePage()
  2.  {
  3.     QString className = field("className").toString();
  4.     headerLineEdit->setText(className.toLower() + ".h");
  5.     implementationLineEdit->setText(className.toLower() + ".cpp");
  6.     outputDirLineEdit->setText(QDir::convertSeparators(QDir::tempPath()));
  7. }

Here, we call QWizardPage::field() to access the contents of the className field (which was defined in the ClassInfoPage) and use it to initialize the OuputFilePage. The field's contents is returned as a QVariant.

When we create a field using QWizardPage::registerField(), we pass a unique field name and a widget. We can also provide a Qt property name and a "changed" signal (a signal that is emitted when the property changes) as third and fourth arguments; however, this is not necessary for the most common Qt widgets, such as QLineEdit, QCheckBox, and QComboBox, because QWizard knows which properties to look for.

If an asterisk (*) is appended to the name when the property is registered, 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.

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

QWizard's mandatory field mechanism is provided for convenience. A more powerful (but also more cumbersome) alternative is to reimplement QWizardPage::isComplete() and to emit the QWizardPage::completeChanged() signal whenever the page becomes complete or incomplete.

The enabled/disabled state of the Next and/or Finish buttons is one way to perform validation on the user input. Another way is to reimplement validateCurrentPage() (or QWizardPage::validatePage()) to perform some last-minute validation (and show an error message if the user has entered incomplete or invalid information). If the function returns true, the next page is shown (or the wizard finishes); otherwise, the current page stays up.

Creating Linear Wizards

Most wizards have a linear structure, with page 1 followed by page 2 and so on until the last page. The Class Wizard example is such a wizard. With QWizard, linear wizards are created by instantiating the QWizardPages and inserting them using addPage(). By default, the pages are shown in the order in which they were added. For example:

  1. ClassWizard::ClassWizard(QWidget *parent)
  2.     : QWizard(parent)
  3.  {
  4.     addPage(new IntroPage);
  5.     addPage(new ClassInfoPage);
  6.     addPage(new CodeStylePage);
  7.     addPage(new OutputFilesPage);
  8.     addPage(new ConclusionPage);
  9.     ...
  10. }

When a page is about to be shown, QWizard calls initializePage() (which in turn calls QWizardPage::initializePage()) to fill the page with default values. By default, this function does nothing, but it can be reimplemented to initialize the page's contents based on other pages' fields (see the example above).

If the user presses Back, cleanupPage() is called (which in turn calls QWizardPage::cleanupPage()). The default implementation resets the page's fields to their original values (the values they had before initializePage() was called). If you want the Back button to be non-destructive and keep the values entered by the user, simply enable the IndependentPages option.

Creating Non-Linear Wizards

Some wizards are more complex in that they allow different traversal paths based on the information provided by the user. The License Wizard example illustrates this. It provides five wizard pages; depending on which options are selected, the user can reach different pages.

In complex wizards, pages are identified by IDs. These IDs are typically defined using an enum. For example:

  1. class LicenseWizard : public QWizard
  2.  {
  3.     ...
  4.     enum  { Page_Intro, Page_Evaluate, Page_Register, Page_Details,
  5.            Page_Conclusion };
  6.     ...
  7. };

The pages are inserted using setPage(), which takes an ID and an instance of QWizardPage (or of a subclass):

  1. LicenseWizard::LicenseWizard(QWidget *parent)
  2.     : QWizard(parent)
  3.  {
  4.     setPage(Page_Intro, new IntroPage);
  5.     setPage(Page_Evaluate, new EvaluatePage);
  6.     setPage(Page_Register, new RegisterPage);
  7.     setPage(Page_Details, new DetailsPage);
  8.     setPage(Page_Conclusion, new ConclusionPage);
  9.     ...
  10. }

By default, the pages are shown in increasing ID order. To provide a dynamic order that depends on the options chosen by the user, we must reimplement QWizardPage::nextId(). For example:

  1. int IntroPage::nextId() const
  2.  {
  3.     if (evaluateRadioButton->isChecked())  {
  4.         return LicenseWizard::Page_Evaluate;
  5.     } else  {
  6.         return LicenseWizard::Page_Register;
  7.     }
  8. }
  9.  
  10. int EvaluatePage::nextId() const
  11.  {
  12.     return LicenseWizard::Page_Conclusion;
  13. }
  14.  
  15. int RegisterPage::nextId() const
  16.  {
  17.     if (upgradeKeyLineEdit->text().isEmpty())  {
  18.         return LicenseWizard::Page_Details;
  19.     } else  {
  20.         return LicenseWizard::Page_Conclusion;
  21.     }
  22. }
  23.  
  24. int DetailsPage::nextId() const
  25.  {
  26.     return LicenseWizard::Page_Conclusion;
  27. }
  28.  
  29. int ConclusionPage::nextId() const
  30.  {
  31.     return -1;
  32. }

It would also be possible to put all the logic in one place, in a QWizard::nextId() reimplementation. For example:

  1. int LicenseWizard::nextId() const
  2.  {
  3.     switch (currentId())  {
  4.     case Page_Intro:
  5.         if (field("intro.evaluate").toBool())  {
  6.             return Page_Evaluate;
  7.         } else  {
  8.             return Page_Register;
  9.         }
  10.     case Page_Evaluate:
  11.         return Page_Conclusion;
  12.     case Page_Register:
  13.         if (field("register.upgradeKey").toString().isEmpty())  {
  14.             return Page_Details;
  15.         } else  {
  16.             return Page_Conclusion;
  17.         }
  18.     case Page_Details:
  19.         return Page_Conclusion;
  20.     case Page_Conclusion:
  21.     default:
  22.         return -1;
  23.     }
  24. }

To start at another page than the page with the lowest ID, call setStartId().

To test whether a page has been visited or not, call hasVisitedPage(). For example:

  1. void ConclusionPage::initializePage()
  2.  {
  3.     QString licenseText;
  4.  
  5.     if (wizard()->hasVisitedPage(LicenseWizard::Page_Evaluate))  {
  6.         licenseText = tr("<u>Evaluation License Agreement:</u> "
  7.                          "You can use this software for 30 days and make one "
  8.                          "backup, but you are not allowed to distribute it.");
  9.     } else if (wizard()->hasVisitedPage(LicenseWizard::Page_Details))  {
  10.         licenseText = tr("<u>First-Time License Agreement:</u> "
  11.                          "You can use this software subject to the license "
  12.                          "you will receive by email.");
  13.     } else  {
  14.         licenseText = tr("<u>Upgrade License Agreement:</u> "
  15.                          "This software is licensed under the terms of your "
  16.                          "current license.");
  17.     }
  18.     bottomLabel->setText(licenseText);
  19. }

See also QWizardPage, Class Wizard Example, and License Wizard Example.

Public Types

Toggle detailsenum QWizard::

WizardButtonWizardButton { BackButton , NextButton , CommitButton , FinishButton , CancelButton , HelpButton , CustomButton1 , CustomButton2 , CustomButton3 , Stretch , NoButton , NStandardButtons , NButtons 9 ...} { BackButton , NextButton , CommitButton , FinishButton , CancelButton , HelpButton , CustomButton1 , CustomButton2 , CustomButton3 , Stretch , NoButton , NStandardButtons , NButtons 9 }

This enum specifies the buttons in a wizard.

ConstantValueDescription
QWizard::BackButton 0 The Back button (Go Back on Mac OS X)
QWizard::NextButton 1 The Next button (Continue on Mac OS X)
QWizard::CommitButton 2 The Commit button
QWizard::FinishButton 3 The Finish button (Done on Mac OS X)
QWizard::CancelButton 4 The Cancel button (see also NoCancelButton)
QWizard::HelpButton 5 The Help button (see also HaveHelpButton)
QWizard::CustomButton1 6 The first user-defined button (see also HaveCustomButton1)
QWizard::CustomButton2 7 The second user-defined button (see also HaveCustomButton2)
QWizard::CustomButton3 8 The third user-defined button (see also HaveCustomButton3)

The following value is only useful when calling setButtonLayout():

ConstantValueDescription
QWizard::Stretch 9 A horizontal stretch in the button layout

See also setButton(), setButtonText(), setButtonLayout(), and customButtonClicked().

Look up this member in the source code.

Toggle detailsenum QWizard::

WizardOptionWizardOption { IndependentPages , IgnoreSubTitles , ExtendedWatermarkPixmap , NoDefaultButton , NoBackButtonOnStartPage , NoBackButtonOnLastPage , DisabledBackButtonOnLastPage , HaveNextButtonOnLastPage , HaveFinishButtonOnEarlyPages , NoCancelButton , CancelButtonOnLeft , HaveHelpButton , HelpButtonOnRight , HaveCustomButton1 , HaveCustomButton2 , HaveCustomButton3 0x00008000 ...} { IndependentPages , IgnoreSubTitles , ExtendedWatermarkPixmap , NoDefaultButton , NoBackButtonOnStartPage , NoBackButtonOnLastPage , DisabledBackButtonOnLastPage , HaveNextButtonOnLastPage , HaveFinishButtonOnEarlyPages , NoCancelButton , CancelButtonOnLeft , HaveHelpButton , HelpButtonOnRight , HaveCustomButton1 , HaveCustomButton2 , HaveCustomButton3 0x00008000 }

This enum specifies various options that affect the look and feel of a wizard.

ConstantValueDescription
QWizard::IndependentPages 0x00000001 The pages are independent of each other (i.e., they don't derive values from each other).
QWizard::IgnoreSubTitles 0x00000002 Don't show any subtitles, even if they are set.
QWizard::ExtendedWatermarkPixmap 0x00000004 Extend any WatermarkPixmap all the way down to the window's edge.
QWizard::NoDefaultButton 0x00000008 Don't make the Next or Finish button the dialog's default button.
QWizard::NoBackButtonOnStartPage 0x00000010 Don't show the Back button on the start page.
QWizard::NoBackButtonOnLastPage 0x00000020 Don't show the Back button on the last page.
QWizard::DisabledBackButtonOnLastPage 0x00000040 Disable the Back button on the last page.
QWizard::HaveNextButtonOnLastPage 0x00000080 Show the (disabled) Next button on the last page.
QWizard::HaveFinishButtonOnEarlyPages 0x00000100 Show the (disabled) Finish button on non-final pages.
QWizard::NoCancelButton 0x00000200 Don't show the Cancel button.
QWizard::CancelButtonOnLeft 0x00000400 Put the Cancel button on the left of Back (rather than on the right of Finish or Next).
QWizard::HaveHelpButton 0x00000800 Show the Help button.
QWizard::HelpButtonOnRight 0x00001000 Put the Help button on the far right of the button layout (rather than on the far left).
QWizard::HaveCustomButton1 0x00002000 Show the first user-defined button (CustomButton1).
QWizard::HaveCustomButton2 0x00004000 Show the second user-defined button (CustomButton2).
QWizard::HaveCustomButton3 0x00008000 Show the third user-defined button (CustomButton3).

See also setOptions(), setOption(), and testOption().

Look up this member in the source code.

Toggle detailsenum QWizard::

WizardPixmapWizardPixmap { WatermarkPixmap , LogoPixmap , BannerPixmap , BackgroundPixmap , NPixmaps 4 ...} { WatermarkPixmap , LogoPixmap , BannerPixmap , BackgroundPixmap , NPixmaps 4 }

This enum specifies the pixmaps that can be associated with a page.

ConstantValueDescription
QWizard::WatermarkPixmap 0 The tall pixmap on the left side of a ClassicStyle or ModernStyle page
QWizard::LogoPixmap 1 The small pixmap on the right side of a ClassicStyle or ModernStyle page header
QWizard::BannerPixmap 2 The pixmap that occupies the background of a ModernStyle page header
QWizard::BackgroundPixmap 3 The pixmap that occupies the background of a MacStyle wizard

See also setPixmap(), QWizardPage::setPixmap(), and Elements of a Wizard Page.

Look up this member in the source code.

Toggle detailsenum QWizard::

WizardStyleWizardStyle { ClassicStyle , ModernStyle , MacStyle , AeroStyle , NStyles 4 ...} { ClassicStyle , ModernStyle , MacStyle , AeroStyle , NStyles 4 }

This enum specifies the different looks supported by QWizard.

ConstantValueDescription
QWizard::ClassicStyle 0 Classic Windows look
QWizard::ModernStyle 1 Modern Windows look
QWizard::MacStyle 2 Mac OS X look
QWizard::AeroStyle 3 Windows Aero look

See also setWizardStyle(), WizardOption, and Wizard Look and Feel.

Look up this member in the source code.

    Properties

    Toggle detailscurrentIdcurrentId : const int

    This property holds the ID of the current page

    This property cannot be set directly. To change the current page, call next(), back(), or restart().

    By default, this property has a value of -1, indicating that no page is currently shown.

    See also currentIdChanged() and currentPage().

    Access functions:

    Look up this member in the source code.

    Toggle detailsoptionsoptions : WizardOptions

    This property holds the various options that affect the look and feel of the wizard

    By default, the following options are set (depending on the platform):

    See also wizardStyle.

    Access functions:

    Look up this member in the source code.

    Toggle detailsstartIdstartId : int

    This property holds the ID of the first page

    If this property isn't explicitly set, this property defaults to the lowest page ID in this wizard, or -1 if no page has been inserted yet.

    See also restart() and nextId().

    Access functions:

    Look up this member in the source code.

    Toggle detailssubTitleFormatsubTitleFormat : Qt::TextFormat

    This property holds the text format used by page subtitles

    The default format is Qt::AutoText.

    See also QWizardPage::title and titleFormat.

    Access functions:

    Look up this member in the source code.

    Toggle detailstitleFormattitleFormat : Qt::TextFormat

    This property holds the text format used by page titles

    The default format is Qt::AutoText.

    See also QWizardPage::title and subTitleFormat.

    Access functions:

    Look up this member in the source code.

    Toggle detailswizardStylewizardStyle : WizardStyle

    This property holds the look and feel of the wizard

    By default, QWizard uses the AeroStyle on a Windows Vista system with alpha compositing enabled, regardless of the current widget style. If this is not the case, the default wizard style depends on the current widget style as follows: MacStyle is the default if the current widget style is QMacStyle, ModernStyle is the default if the current widget style is QWindowsStyle, and ClassicStyle is the default in all other cases.

    See also Wizard Look and Feel and options.

    Access functions:

    Look up this member in the source code.

      Public Functions

      Toggle details QWizard

      QWizardQWizard ( QWidget *parent=0 , Qt::WindowFlags flags=0 ...) ( QWidget *parent=0 , Qt::WindowFlags flags=0 )

      Constructs a wizard with the given parent and window flags.

      See also parent() and windowFlags().

      Look up this member in the source code.

      Toggle details QWizard

      ~QWizard~QWizard () ()

      Destroys the wizard and its pages, releasing any allocated resources.

      Look up this member in the source code.

      Toggle details int QWizard

      addPageaddPage ( QWizardPage *page ) ( QWizardPage *page )

      Adds the given page to the wizard, and returns the page's ID.

      The ID is guaranteed to be larger than any other ID in the QWizard so far.

      See also setPage(), page(), and pageAdded().

      Look up this member in the source code.

      Toggle details QAbstractButton * QWizard

      buttonbutton ( WizardButton which ) ( WizardButton which )const

      Returns the button corresponding to role which.

      See also setButton() and setButtonText().

      Look up this member in the source code.

      Toggle details QString QWizard

      buttonTextbuttonText ( WizardButton which ) ( WizardButton which )const

      Returns the text on button which.

      If a text has ben set using setButtonText(), this text is returned.

      By default, the text on buttons depends on the wizardStyle. For example, on Mac OS X, the Next button is called Continue.

      See also button(), setButton(), setButtonText(), QWizardPage::buttonText(), and QWizardPage::setButtonText().

      Look up this member in the source code.

      Toggle details void QWizard

      cleanupPagecleanupPage ( int id ) ( int id ) [virtual protected]

      This virtual function is called by QWizard to clean up page id just before the user leaves it by clicking Back (unless the QWizard::IndependentPages option is set).

      The default implementation calls QWizardPage::cleanupPage() on page(id).

      See also QWizardPage::cleanupPage() and initializePage().

      Look up this member in the source code.

      Toggle details QWizardPage * QWizard

      currentPagecurrentPage () ()const

      Returns a pointer to the current page, or 0 if there is no current page (e.g., before the wizard is shown).

      This is equivalent to calling page(currentId()).

      See also page(), currentId(), and restart().

      Look up this member in the source code.

      Toggle details void QWizard

      donedone ( int result ) ( int result ) [virtual protected]

      Reimplemented from QDialog::done().

      Look up this member in the source code.

      Toggle details bool QWizard

      eventevent ( QEvent *event ) ( QEvent *event ) [virtual protected]

      Reimplemented from QObject::event().

      Look up this member in the source code.

      Toggle details QVariant QWizard

      fieldfield ( const QString &name ) ( const QString &name )const

      Returns the value of the field called name.

      This function can be used to access fields on any page of the wizard.

      See also QWizardPage::registerField(), QWizardPage::field(), and setField().

      Look up this member in the source code.

      Toggle details bool QWizard

      hasVisitedPagehasVisitedPage ( int id ) ( int id )const

      Returns true if the page history contains page id; otherwise, returns false.

      Pressing Back marks the current page as "unvisited" again.

      See also visitedPages().

      Look up this member in the source code.

      Toggle details void QWizard

      initializePageinitializePage ( int id ) ( int id ) [virtual protected]

      This virtual function is called by QWizard to prepare page id 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.

      The default implementation calls QWizardPage::initializePage() on page(id).

      See also QWizardPage::initializePage() and cleanupPage().

      Look up this member in the source code.

      Toggle details int QWizard

      nextIdnextId () ()const [virtual]

      This virtual function is called by QWizard to find out which page to show when the user clicks the Next button.

      The return value is the ID of the next page, or -1 if no page follows.

      The default implementation calls QWizardPage::nextId() on the currentPage().

      By reimplementing this function, you can specify a dynamic page order.

      See also QWizardPage::nextId() and currentPage().

      Look up this member in the source code.

      Toggle details QWizardPage * QWizard

      pagepage ( int id ) ( int id )const

      Returns the page with the given id, or 0 if there is no such page.

      See also addPage() and setPage().

      Look up this member in the source code.

      Toggle details QList <int > QWizard

      pageIdspageIds () ()const

      Returns the list of page IDs.

      Look up this member in the source code.

      Toggle details void QWizard

      paintEventpaintEvent ( QPaintEvent *event ) ( QPaintEvent *event ) [virtual protected]

      Reimplemented from QWidget::paintEvent().

      Look up this member in the source code.

      Toggle details QPixmap QWizard

      pixmappixmap ( WizardPixmap which ) ( WizardPixmap which )const

      Returns the pixmap set for role which.

      By default, the only pixmap that is set is the BackgroundPixmap on Mac OS X.

      See also setPixmap(), QWizardPage::pixmap(), and Elements of a Wizard Page.

      Look up this member in the source code.

      Toggle details void QWizard

      removePageremovePage ( int id ) ( int id )

      Removes the page with the given id. cleanupPage() will be called if necessary.

      Note: Removing a page may influence the value of the startId property.

      See also addPage(), setPage(), pageRemoved(), and startId().

      Look up this member in the source code.

      Toggle details void QWizard

      resizeEventresizeEvent ( QResizeEvent *event ) ( QResizeEvent *event ) [virtual protected]

      Reimplemented from QWidget::resizeEvent().

      Look up this member in the source code.

      Toggle details void QWizard

      setButtonsetButton ( WizardButton which , QAbstractButton *button ...) ( WizardButton which , QAbstractButton *button )

      Sets the button corresponding to role which to button.

      To add extra buttons to the wizard (e.g., a Print button), one way is to call setButton() with CustomButton1 to CustomButton3, and make the buttons visible using the HaveCustomButton1 to HaveCustomButton3 options.

      See also button(), setButtonText(), setButtonLayout(), and options.

      Look up this member in the source code.

      Toggle details void QWizard

      setButtonLayoutsetButtonLayout ( const QList <WizardButton > &layout ...) ( const QList <WizardButton > &layout )

      Sets the order in which buttons are displayed to layout, where layout is a list of WizardButtons.

      The default layout depends on the options (e.g., whether HelpButtonOnRight) that are set. You can call this function if you need more control over the buttons' layout than what options already provides.

      You can specify horizontal stretches in the layout using Stretch.

      Example:

      1. MyWizard::MyWizard(QWidget *parent)
      2.     : QWizard(parent)
      3.  {
      4.     ...
      5.     QList<QWizard::WizardButton> layout;
      6.     layout << QWizard::Stretch << QWizard::BackButton << QWizard::CancelButton
      7.            << QWizard::NextButton << QWizard::FinishButton;
      8.     setButtonLayout(layout);
      9.     ...
      10. }

      See also setButton(), setButtonText(), and setOptions().

      Look up this member in the source code.

      Toggle details void QWizard

      setButtonTextsetButtonText ( WizardButton which , const QString &text ...) ( WizardButton which , const QString &text )

      Sets the text on button which to be text.

      By default, the text on buttons depends on the wizardStyle. For example, on Mac OS X, the Next button is called Continue.

      To add extra buttons to the wizard (e.g., a Print button), one way is to call setButtonText() with CustomButton1, CustomButton2, or CustomButton3 to set their text, and make the buttons visible using the HaveCustomButton1, HaveCustomButton2, and/or HaveCustomButton3 options.

      Button texts may also be set on a per-page basis using QWizardPage::setButtonText().

      See also buttonText(), setButton(), button(), setButtonLayout(), setOptions(), and QWizardPage::setButtonText().

      Look up this member in the source code.

      Toggle details void QWizard

      setDefaultPropertysetDefaultProperty ( const char *className , const char *property , const char *changedSignal ...) ( const char *className , const char *property , const char *changedSignal )

      Sets the default property for className to be property, and the associated change signal to be changedSignal.

      The default property is used when an instance of className (or of one of its subclasses) is passed to QWizardPage::registerField() and no property is specified.

      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:

      WidgetPropertyChange Notification Signal
      QAbstractButtonbool checked toggled()
      QAbstractSliderint value valueChanged()
      QComboBoxint currentIndex currentIndexChanged()
      QDateTimeEdit QDateTime dateTime dateTimeChanged()
      QLineEdit QString text textChanged()
      QListWidgetint currentRow currentRowChanged()
      QSpinBoxint value valueChanged()

      See also QWizardPage::registerField().

      Look up this member in the source code.

      Toggle details void QWizard

      setFieldsetField ( const QString &name , const QVariant &value ...) ( const QString &name , const QVariant &value )

      Sets the value of the field called name to value.

      This function can be used to set fields on any page of the wizard.

      See also QWizardPage::registerField(), QWizardPage::setField(), and field().

      Look up this member in the source code.

      Toggle details void QWizard

      setOptionsetOption ( WizardOption option , bool on=true ...) ( WizardOption option , bool on=true )

      Sets the given option to be enabled if on is true; otherwise, clears the given option.

      See also options, testOption(), and setWizardStyle().

      Look up this member in the source code.

      Toggle details void QWizard

      setPagesetPage ( int id , QWizardPage *page ) ( int id , QWizardPage *page )

      Adds the given page to the wizard with the given id.

      Note: Adding a page may influence the value of the startId property in case it was not set explicitly.

      See also addPage(), page(), and pageAdded().

      Look up this member in the source code.

      Toggle details void QWizard

      setPixmapsetPixmap ( WizardPixmap which , const QPixmap &pixmap ...) ( WizardPixmap which , const QPixmap &pixmap )

      Sets the pixmap for role which to pixmap.

      The pixmaps are used by QWizard when displaying a page. Which pixmaps are actually used depend on the wizard style.

      Pixmaps can also be set for a specific page using QWizardPage::setPixmap().

      See also pixmap(), QWizardPage::setPixmap(), and Elements of a Wizard Page.

      Look up this member in the source code.

      Toggle details void QWizard

      setSideWidgetsetSideWidget ( QWidget *widget ) ( QWidget *widget )

      Sets the given widget to be shown on the left side of the wizard. For styles which use the WatermarkPixmap (ClassicStyle and ModernStyle) the side widget is displayed on top of the watermark, for other styles or when the watermark is not provided the side widget is displayed on the left side of the wizard.

      Passing 0 shows no side widget.

      When the widget is not 0 the wizard reparents it.

      Any previous side widget is hidden.

      You may call setSideWidget() with the same widget at different times.

      All widgets set here will be deleted by the wizard when it is destroyed unless you separately reparent the widget after setting some other side widget (or 0).

      By default, no side widget is present.

      See also sideWidget().

      Look up this member in the source code.

      Toggle details void QWizard

      setVisiblesetVisible ( bool visible ) ( bool visible ) [virtual]

      Reimplemented from QWidget::setVisible().

      Look up this member in the source code.

      Toggle details QWidget * QWizard

      sideWidgetsideWidget () ()const

      Returns the widget on the left side of the wizard or 0.

      By default, no side widget is present.

      See also setSideWidget().

      Look up this member in the source code.

      Toggle details QSize QWizard

      sizeHintsizeHint () ()const [virtual]

      Reimplemented from QWidget::sizeHint().

      Look up this member in the source code.

      Toggle details bool QWizard

      testOptiontestOption ( WizardOption option ) ( WizardOption option )const

      Returns true if the given option is enabled; otherwise, returns false.

      See also options, setOption(), and setWizardStyle().

      Look up this member in the source code.

      Toggle details bool QWizard

      validateCurrentPagevalidateCurrentPage () () [virtual]

      This virtual function is called by QWizard 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 calls QWizardPage::validatePage() on the currentPage().

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

      See also QWizardPage::validatePage() and currentPage().

      Look up this member in the source code.

      Toggle details QList <int > QWizard

      visitedPagesvisitedPages () ()const

      Returns the list of IDs of visited pages, in the order in which the pages were visited.

      Pressing Back marks the current page as "unvisited" again.

      See also hasVisitedPage().

      Look up this member in the source code.

      Toggle details bool QWizard

      winEventwinEvent ( MSG *message , long *result ) ( MSG *message , long *result ) [virtual protected]

      Reimplemented from QWidget::winEvent().

      Look up this member in the source code.

        Signals

        Toggle details void QWizard

        currentIdChangedcurrentIdChanged ( int id ) ( int id ) [signal]

        This signal is emitted when the current page changes, with the new current id.

        See also currentId() and currentPage().

        Look up this member in the source code.

        Toggle details void QWizard

        customButtonClickedcustomButtonClicked ( int which ) ( int which ) [signal]

        This signal is emitted when the user clicks a custom button. which can be CustomButton1, CustomButton2, or CustomButton3.

        By default, no custom button is shown. Call setOption() with HaveCustomButton1, HaveCustomButton2, or HaveCustomButton3 to have one, and use setButtonText() or setButton() to configure it.

        See also helpRequested().

        Look up this member in the source code.

        Toggle details void QWizard

        helpRequestedhelpRequested () () [signal]

        This signal is emitted when the user clicks the Help button.

        By default, no Help button is shown. Call setOption(HaveHelpButton, true) to have one.

        Example:

        1. LicenseWizard::LicenseWizard(QWidget *parent)
        2.     : QWizard(parent)
        3.  {
        4.     ...
        5.     setOption(HaveHelpButton, true);
        6.     connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));
        7.     ...
        8. }
        9.  
        10. void LicenseWizard::showHelp()
        11.  {
        12.     static QString lastHelpMessage;
        13.  
        14.     QString message;
        15.  
        16.     switch (currentId())  {
        17.     case Page_Intro:
        18.         message = tr("The decision you make here will affect which page you "
        19.                      "get to see next.");
        20.         break;
        21.     ...
        22.     default:
        23.         message = tr("This help is likely not to be of any help.");
        24.     }
        25.  
        26.     QMessageBox::information(this, tr("License Wizard Help"), message);
        27.  
        28. }

        See also customButtonClicked().

        Look up this member in the source code.

        Toggle details void QWizard

        pageAddedpageAdded ( int id ) ( int id ) [signal]

        This signal is emitted whenever a page is added to the wizard. The page's id is passed as parameter.

        See also addPage(), setPage(), and startId().

        Look up this member in the source code.

        Toggle details void QWizard

        pageRemovedpageRemoved ( int id ) ( int id ) [signal]

        This signal is emitted whenever a page is removed from the wizard. The page's id is passed as parameter.

        See also removePage() and startId().

        Look up this member in the source code.

          Public Slots

          Toggle details void QWizard

          backback () () [slot]

          Goes back to the previous page.

          This is equivalent to pressing the Back button.

          See also next(), accept(), reject(), and restart().

          Look up this member in the source code.

          Toggle details void QWizard

          nextnext () () [slot]

          Advances to the next page.

          This is equivalent to pressing the Next or Commit button.

          See also nextId(), back(), accept(), reject(), and restart().

          Look up this member in the source code.

          Toggle details void QWizard

          restartrestart () () [slot]

          Restarts the wizard at the start page. This function is called automatically when the wizard is shown.

          See also startId().

          Look up this member in the source code.

            Notes provided by the Qt Community

            No notes