QWizardPage Class
The QWizardPage class is a page of a QWizard. More…
| Header | #include <QWizardPage> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Widgets) |
| Module | Nt Widgets C++ Classes |
| Inherits | QWidget |
List of all members, including inherited members
Public Functions
| QWizardPage(QWidget *parent = nullptr) | |
| ~QWizardPage() | |
| void | setTitle(const QString &title) |
| QString | title() const |
| void | setSubTitle(const QString &subTitle) |
| QString | subTitle() const |
| void | setFinalPage(bool finalPage) |
| bool | isFinalPage() const |
| void | setCommitPage(bool commitPage) |
| bool | isCommitPage() const |
| void | setButtonText(QWizard::WizardButton which, const QString &text) |
| QString | buttonText(QWizard::WizardButton which) const |
| virtual void | initializePage() |
| virtual void | cleanupPage() |
| virtual bool | validatePage() |
| virtual bool | isComplete() const |
| virtual int | nextId() const |
Signals
| void | completeChanged() |
Protected Functions
| void | setField(const QString &name, const QVariant &value) |
| QVariant | field(const QString &name) const |
| void | registerField(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
QWizardPage::QWizardPage(QWidget *parent = nullptr)
Constructs a wizard page with the given parent.
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().
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().
void QWizardPage::completeChanged()
This signal is emitted when what isComplete() returns may have changed. A wizard updates its buttons then.
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().
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.
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.
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.
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().
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.
bool QWizardPage::validatePage()
Returns whether the user may leave the page with Next, Commit or Finish. The default implementation returns true.
QWizard * QWizardPage::wizard() const
Returns the wizard that the page is in, or nullptr.