6.0.0-rc4Source

QWizardPage Class

The QWizardPage class is a page of a QWizard. More…

Header#include <QWizardPage>
CMaketarget_link_libraries(app PRIVATE Nt::Widgets)
ModuleNt Widgets C++ Classes
InheritsQWidget

List of all members, including inherited members

Public Functions

QWizardPage(QWidget *parent = nullptr)
~QWizardPage()
voidsetTitle(const QString &title)
QStringtitle() const
voidsetSubTitle(const QString &subTitle)
QStringsubTitle() const
voidsetFinalPage(bool finalPage)
boolisFinalPage() const
voidsetCommitPage(bool commitPage)
boolisCommitPage() const
voidsetButtonText(QWizard::WizardButton which, const QString &text)
QStringbuttonText(QWizard::WizardButton which) const
virtual voidinitializePage()
virtual voidcleanupPage()
virtual boolvalidatePage()
virtual boolisComplete() const
virtual intnextId() const

Signals

Protected Functions

voidsetField(const QString &name, const QVariant &value)
QVariantfield(const QString &name) const
voidregisterField(const QString &name, QWidget *widget, const char *property = nullptr, const char *changedSignal = nullptr)
QWizard *wizard() const

Detailed Description

A wizard page is a widget with a title and a subtitle. Subclass it to fill in its widgets, and register the fields that later pages and the wizard read:

class DetailsPage : public QWizardPage {
public:
    DetailsPage() {
        setTitle("Details");
        auto *name = new QLineEdit;
        registerField("name*", name); // mandatory
        auto *layout = new QVBoxLayout(this);
        layout->addWidget(name);
    }
};

Reimplement initializePage() to fill the page from the fields of earlier pages, validatePage() to check it before the user goes on, isComplete() to say when Next is enabled, and nextId() to choose the next page.

See also QWizard.

Differences from Qt

See QWizard.

Member Function Documentation

[explicit] QWizardPage::QWizardPage(QWidget *parent = nullptr)

Constructs a wizard page with the given parent.

[override] QWizardPage::~QWizardPage()

Destroys the page; a wizard that has it forgets it.

QString QWizardPage::buttonText(QWizard::WizardButton which) const

Returns the text of the button which on this page.

See also setButtonText().

[virtual] void QWizardPage::cleanupPage()

Is called when the user leaves the page with Back. The default implementation sets the fields of the page back to their starting values.

See also initializePage().

[signal] void QWizardPage::completeChanged()

This signal is emitted when what isComplete() returns may have changed. A wizard updates its buttons then.

[protected] QVariant QWizardPage::field(const QString &name) const

Returns the value of the field name, of this page or another page of the wizard.

See also setField() and registerField().

[virtual] void QWizardPage::initializePage()

Is called before the page is shown when the user goes to it. The default implementation does nothing.

See also cleanupPage().

bool QWizardPage::isCommitPage() const

Returns whether the page is a commit page.

[virtual] bool QWizardPage::isComplete() const

Returns whether the page is complete, which enables Next, Commit and Finish. The default implementation returns true if every mandatory field has been changed from its starting value and is not an empty text.

See also completeChanged().

bool QWizardPage::isFinalPage() const

Returns whether the page is a last page: it was set so, or nextId() returns -1.

[virtual] int QWizardPage::nextId() const

Returns the id of the page after this one, or -1 if it is the last. The default implementation returns the next larger id of the wizard.

[protected] void QWizardPage::registerField(const QString &name, QWidget *widget, const char *property = nullptr, const char *changedSignal = nullptr)

Registers the field name for the property of widget, which the wizard reads with QWizard::field(). A name that ends with "*" is mandatory: the page is not complete until it changes. Without property, the property of the widget type is used: the text of a QLineEdit, the checked state of a button, the value of a spin box or a slider, the current index of a combo box, the plain text of a QPlainTextEdit and the current row of a QListWidget. changedSignal, given with SIGNAL(), tells the page when the property changes; it is needed only for other widgets.

void QWizardPage::setButtonText(QWizard::WizardButton which, const QString &text)

Sets the text of the button which on this page to text.

See also buttonText().

void QWizardPage::setCommitPage(bool commitPage)

Sets whether the page is a commit page to commitPage: its Next button is a Commit button, and the user cannot go back past it.

See also isCommitPage().

[protected] void QWizardPage::setField(const QString &name, const QVariant &value)

Sets the field name, of this page or another page of the wizard, to value.

See also field().

void QWizardPage::setFinalPage(bool finalPage)

Sets whether the page is a last page, with a Finish button, even if nextId() leads on, to finalPage.

See also isFinalPage().

void QWizardPage::setSubTitle(const QString &subTitle)

Sets the subtitle of the page to subTitle, which the wizard shows under the title unless IgnoreSubTitles is set.

See also subTitle().

void QWizardPage::setTitle(const QString &title)

Sets the title of the page to title, which the wizard shows above it.

See also title().

QString QWizardPage::subTitle() const

Returns the subtitle of the page.

QString QWizardPage::title() const

Returns the title of the page.

[virtual] bool QWizardPage::validatePage()

Returns whether the user may leave the page with Next, Commit or Finish. The default implementation returns true.

[protected] QWizard * QWizardPage::wizard() const

Returns the wizard that the page is in, or nullptr.