QtBase
v6.3.1
|
The QWizard class provides a framework for wizards. More...
#include <qwizard.h>
Public Slots | |
void | back () |
void | next () |
void | restart () |
Public Slots inherited from QDialog | |
virtual void | open () |
virtual int | exec () |
virtual void | accept () |
virtual void | reject () |
Public Slots inherited from QWidget | |
void | setEnabled (bool) |
void | setDisabled (bool) |
void | setWindowModified (bool) |
void | setWindowTitle (const QString &) |
void | setStyleSheet (const QString &styleSheet) |
void | setFocus () |
void | update () |
void | repaint () |
void | setHidden (bool hidden) |
void | show () |
void | hide () |
void | showMinimized () |
void | showMaximized () |
void | showFullScreen () |
void | showNormal () |
bool | close () |
void | raise () |
void | lower () |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals | |
void | currentIdChanged (int id) |
void | helpRequested () |
void | customButtonClicked (int which) |
void | pageAdded (int id) |
void | pageRemoved (int id) |
Signals inherited from QDialog | |
void | finished (int result) |
void | accepted () |
void | rejected () |
Signals inherited from QWidget | |
void | windowTitleChanged (const QString &title) |
void | windowIconChanged (const QIcon &icon) |
void | windowIconTextChanged (const QString &iconText) |
void | customContextMenuRequested (const QPoint &pos) |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Properties | |
WizardStyle | wizardStyle |
the look and feel of the wizard More... | |
WizardOptions | options |
the various options that affect the look and feel of the wizard More... | |
Qt::TextFormat | titleFormat |
the text format used by page titles More... | |
Qt::TextFormat | subTitleFormat |
the text format used by page subtitles More... | |
int | startId |
the ID of the first page More... | |
int | currentId |
the ID of the current page More... | |
Properties inherited from QDialog | |
bool | sizeGripEnabled |
whether the size grip is enabled More... | |
bool | modal |
whether show() should pop up the dialog as modal or modeless More... | |
Properties inherited from QWidget | |
bool | modal |
whether the widget is a modal widget More... | |
Qt::WindowModality | windowModality |
which windows are blocked by the modal widget More... | |
bool | enabled |
whether the widget is enabled More... | |
QRect | geometry |
the geometry of the widget relative to its parent and excluding the window frame More... | |
QRect | frameGeometry |
geometry of the widget relative to its parent including any window frame More... | |
QRect | normalGeometry |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget More... | |
int | x |
the x coordinate of the widget relative to its parent including any window frame More... | |
int | y |
the y coordinate of the widget relative to its parent and including any window frame More... | |
QPoint | pos |
the position of the widget within its parent widget More... | |
QSize | frameSize |
the size of the widget including any window frame More... | |
QSize | size |
the size of the widget excluding any window frame More... | |
int | width |
the width of the widget excluding any window frame More... | |
int | height |
the height of the widget excluding any window frame More... | |
QRect | rect |
the internal geometry of the widget excluding any window frame More... | |
QRect | childrenRect |
the bounding rectangle of the widget's children More... | |
QRegion | childrenRegion |
the combined region occupied by the widget's children More... | |
QSizePolicy | sizePolicy |
the default layout behavior of the widget More... | |
QSize | minimumSize |
the widget's minimum size More... | |
QSize | maximumSize |
the widget's maximum size in pixels More... | |
int | minimumWidth |
the widget's minimum width in pixels More... | |
int | minimumHeight |
the widget's minimum height in pixels More... | |
int | maximumWidth |
the widget's maximum width in pixels More... | |
int | maximumHeight |
the widget's maximum height in pixels More... | |
QSize | sizeIncrement |
the size increment of the widget More... | |
QSize | baseSize |
the base size of the widget More... | |
QPalette | palette |
the widget's palette More... | |
QFont | font |
the font currently set for the widget More... | |
QCursor | cursor |
the cursor shape for this widget More... | |
bool | mouseTracking |
whether mouse tracking is enabled for the widget More... | |
bool | tabletTracking |
whether tablet tracking is enabled for the widget More... | |
bool | isActiveWindow |
whether this widget's window is the active window More... | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus More... | |
bool | focus |
whether this widget (or its focus proxy) has the keyboard input focus More... | |
Qt::ContextMenuPolicy | contextMenuPolicy |
how the widget shows a context menu More... | |
bool | updatesEnabled |
whether updates are enabled More... | |
bool | visible |
whether the widget is visible More... | |
bool | minimized |
whether this widget is minimized (iconified) More... | |
bool | maximized |
whether this widget is maximized More... | |
bool | fullScreen |
whether the widget is shown in full screen mode More... | |
QSize | sizeHint |
the recommended size for the widget More... | |
QSize | minimumSizeHint |
the recommended minimum size for the widget More... | |
bool | acceptDrops |
whether drop events are enabled for this widget More... | |
QString | windowTitle |
the window title (caption) More... | |
QIcon | windowIcon |
the widget's icon More... | |
QString | windowIconText |
the text to be displayed on the icon of a minimized window More... | |
double | windowOpacity |
The level of opacity for the window. More... | |
bool | windowModified |
whether the document shown in the window has unsaved changes More... | |
QString | accessibleName |
the widget's name as seen by assistive technologies More... | |
QString | accessibleDescription |
the widget's description as seen by assistive technologies More... | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. More... | |
bool | autoFillBackground |
whether the widget background is filled automatically More... | |
QString | styleSheet |
the widget's style sheet More... | |
QLocale | locale |
the widget's locale More... | |
QString | windowFilePath |
the file path associated with a widget More... | |
Qt::InputMethodHints | inputMethodHints |
What input method specific hints the widget has. More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
The QWizard class provides a framework for wizards.
\inmodule QtWidgets
A wizard (also called an assistant on \macos) 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:
This enum specifies the buttons in a wizard.
\value BackButton The \uicontrol Back button (\uicontrol {Go Back} on \macos) \value NextButton The \uicontrol Next button (\uicontrol Continue on \macos) \value CommitButton The \uicontrol Commit button \value FinishButton The \uicontrol Finish button (\uicontrol Done on \macos) \value CancelButton The \uicontrol Cancel button (see also NoCancelButton) \value HelpButton The \uicontrol Help button (see also HaveHelpButton) \value CustomButton1 The first user-defined button (see also HaveCustomButton1) \value CustomButton2 The second user-defined button (see also HaveCustomButton2) \value CustomButton3 The third user-defined button (see also HaveCustomButton3)
The following value is only useful when calling setButtonLayout():
\value Stretch A horizontal stretch in the button layout
\omitvalue NoButton \omitvalue NStandardButtons \omitvalue NButtons
Enumerator | |
---|---|
BackButton | |
NextButton | |
CommitButton | |
FinishButton | |
CancelButton | |
HelpButton | |
CustomButton1 | |
CustomButton2 | |
CustomButton3 | |
Stretch | |
NoButton | |
NStandardButtons | |
NButtons |
This enum specifies various options that affect the look and feel of a wizard.
\value IndependentPages The pages are independent of each other (i.e., they don't derive values from each other). \value IgnoreSubTitles Don't show any subtitles, even if they are set. \value ExtendedWatermarkPixmap Extend any WatermarkPixmap all the way down to the window's edge. \value NoDefaultButton Don't make the \uicontrol Next or \uicontrol Finish button the dialog's \l{QPushButton::setDefault()}{default button}. \value NoBackButtonOnStartPage Don't show the \uicontrol Back button on the start page. \value NoBackButtonOnLastPage Don't show the \uicontrol Back button on the last page. \value DisabledBackButtonOnLastPage Disable the \uicontrol Back button on the last page. \value HaveNextButtonOnLastPage Show the (disabled) \uicontrol Next button on the last page. \value HaveFinishButtonOnEarlyPages Show the (disabled) \uicontrol Finish button on non-final pages. \value NoCancelButton Don't show the \uicontrol Cancel button. \value CancelButtonOnLeft Put the \uicontrol Cancel button on the left of \uicontrol Back (rather than on the right of \uicontrol Finish or \uicontrol Next). \value HaveHelpButton Show the \uicontrol Help button. \value HelpButtonOnRight Put the \uicontrol Help button on the far right of the button layout (rather than on the far left). \value HaveCustomButton1 Show the first user-defined button (CustomButton1). \value HaveCustomButton2 Show the second user-defined button (CustomButton2). \value HaveCustomButton3 Show the third user-defined button (CustomButton3). \value NoCancelButtonOnLastPage Don't show the \uicontrol Cancel button on the last page.
This enum specifies the pixmaps that can be associated with a page.
\value WatermarkPixmap The tall pixmap on the left side of a ClassicStyle or ModernStyle page \value LogoPixmap The small pixmap on the right side of a ClassicStyle or ModernStyle page header \value BannerPixmap The pixmap that occupies the background of a ModernStyle page header \value BackgroundPixmap The pixmap that occupies the background of a MacStyle wizard
\omitvalue NPixmaps
Enumerator | |
---|---|
WatermarkPixmap | |
LogoPixmap | |
BannerPixmap | |
BackgroundPixmap | |
NPixmaps |
enum QWizard::WizardStyle |
This enum specifies the different looks supported by QWizard.
\value ClassicStyle Classic Windows look \value ModernStyle Modern Windows look \value MacStyle \macos look \value AeroStyle Windows Aero look
\omitvalue NStyles
Enumerator | |
---|---|
ClassicStyle | |
ModernStyle | |
MacStyle | |
AeroStyle | |
NStyles |
Constructs a wizard with the given parent and window flags.
Definition at line 2199 of file qwizard.cpp.
QWizard::~QWizard | ( | ) |
Destroys the wizard and its pages, releasing any allocated resources.
Definition at line 2209 of file qwizard.cpp.
int QWizard::addPage | ( | 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.
Definition at line 2223 of file qwizard.cpp.
|
slot |
QAbstractButton * QWizard::button | ( | WizardButton | which | ) | const |
Returns the button corresponding to role which.
Definition at line 2806 of file qwizard.cpp.
QString QWizard::buttonText | ( | 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 \macos, the \uicontrol Next button is called \uicontrol Continue.
Definition at line 2704 of file qwizard.cpp.
|
protectedvirtual |
This virtual function is called by QWizard to clean up page id just before the user leaves it by clicking \uicontrol Back (unless the \l QWizard::IndependentPages option is set).
The default implementation calls QWizardPage::cleanupPage() on page(id).
Definition at line 3331 of file qwizard.cpp.
int QWizard::currentId | ( | ) | const |
Definition at line 2481 of file qwizard.cpp.
|
signal |
This signal is emitted when the current page changes, with the new current id.
QWizardPage * QWizard::currentPage | ( | ) | const |
Returns a pointer to the current page, or \nullptr if there is no current page (e.g., before the wizard is shown).
This is equivalent to calling page(currentId()).
Definition at line 2463 of file qwizard.cpp.
|
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.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QDialog.
Definition at line 3282 of file qwizard.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QObject.
Definition at line 3162 of file qwizard.cpp.
Returns the value of the field called name.
This function can be used to access fields on any page of the wizard.
Definition at line 2517 of file qwizard.cpp.
bool QWizard::hasVisitedPage | ( | int | id | ) | const |
Returns true
if the page history contains page id; otherwise, returns false
.
Pressing \uicontrol Back marks the current page as "unvisited" again.
Definition at line 2389 of file qwizard.cpp.
|
signal |
This signal is emitted when the user clicks the \uicontrol Help button.
By default, no \uicontrol Help button is shown. Call setOption(HaveHelpButton, true) to have one.
Example:
\dots
\dots
\codeline
\dots
\codeline
\codeline
|
protectedvirtual |
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 \uicontrol Next. (However, if the \l 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).
Definition at line 3313 of file qwizard.cpp.
|
slot |
|
virtual |
This virtual function is called by QWizard to find out which page to show when the user clicks the \uicontrol 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.
Definition at line 3377 of file qwizard.cpp.
QWizard::WizardOptions QWizard::options | ( | ) | const |
QWizardPage * QWizard::page | ( | int | id | ) | const |
Returns the page with the given id, or \nullptr if there is no such page.
Definition at line 2373 of file qwizard.cpp.
|
signal |
QList< int > QWizard::pageIds | ( | ) | const |
|
signal |
This signal is emitted whenever a page is removed from the wizard. The page's id is passed as parameter.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 3224 of file qwizard.cpp.
QPixmap QWizard::pixmap | ( | WizardPixmap | which | ) | const |
Returns the pixmap set for role which.
By default, the only pixmap that is set is the BackgroundPixmap on \macos version 10.13 and earlier.
Definition at line 2888 of file qwizard.cpp.
void QWizard::removePage | ( | int | id | ) |
Removes the page with the given id. cleanupPage() will be called if necessary.
Definition at line 2299 of file qwizard.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QDialog.
Definition at line 3202 of file qwizard.cpp.
|
slot |
Restarts the wizard at the start page. This function is called automatically when the wizard is shown.
Definition at line 3150 of file qwizard.cpp.
void QWizard::setButton | ( | WizardButton | which, |
QAbstractButton * | button | ||
) |
Sets the button corresponding to role which to button.
To add extra buttons to the wizard (e.g., a \uicontrol Print button), one way is to call setButton() with CustomButton1 to CustomButton3, and make the buttons visible using the HaveCustomButton1 to HaveCustomButton3 options.
Definition at line 2776 of file qwizard.cpp.
void QWizard::setButtonLayout | ( | const QList< WizardButton > & | layout | ) |
Sets the order in which buttons are displayed to layout, where layout is a list of \l{WizardButton}s.
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 \l options already provides.
You can specify horizontal stretches in the layout using \l Stretch.
Example:
Definition at line 2739 of file qwizard.cpp.
void QWizard::setButtonText | ( | 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 \macos, the \uicontrol Next button is called \uicontrol Continue.
To add extra buttons to the wizard (e.g., a \uicontrol 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().
Definition at line 2679 of file qwizard.cpp.
void QWizard::setDefaultProperty | ( | 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:
\table \header
Definition at line 2924 of file qwizard.cpp.
Sets the value of the field called name to value.
This function can be used to set fields on any page of the wizard.
Definition at line 2494 of file qwizard.cpp.
void QWizard::setOption | ( | WizardOption | option, |
bool | on = true |
||
) |
Sets the given option to be enabled if on is true; otherwise, clears the given option.
Definition at line 2595 of file qwizard.cpp.
void QWizard::setOptions | ( | WizardOptions | options | ) |
void QWizard::setPage | ( | int | id, |
QWizardPage * | page | ||
) |
Adds the given page to the wizard with the given id.
Definition at line 2243 of file qwizard.cpp.
void QWizard::setPixmap | ( | 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 \l{Wizard Look and Feel}{wizard style}.
Pixmaps can also be set for a specific page using QWizardPage::setPixmap().
Definition at line 2872 of file qwizard.cpp.
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 \nullptr shows no side widget.
When the widget is not \nullptr 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 \nullptr).
By default, no side widget is present.
Definition at line 2961 of file qwizard.cpp.
void QWizard::setStartId | ( | int | id | ) |
void QWizard::setSubTitleFormat | ( | Qt::TextFormat | format | ) |
Definition at line 2847 of file qwizard.cpp.
void QWizard::setTitleFormat | ( | Qt::TextFormat | format | ) |
Definition at line 2826 of file qwizard.cpp.
|
overridevirtual |
\reimp
Reimplemented from QDialog.
Definition at line 2989 of file qwizard.cpp.
void QWizard::setWizardStyle | ( | WizardStyle | style | ) |
Definition at line 2543 of file qwizard.cpp.
QWidget * QWizard::sideWidget | ( | ) | const |
Returns the widget on the left side of the wizard or \nullptr.
By default, no side widget is present.
Definition at line 2979 of file qwizard.cpp.
|
overridevirtual |
\reimp
Reimplemented from QDialog.
Definition at line 3002 of file qwizard.cpp.
int QWizard::startId | ( | ) | const |
Definition at line 2449 of file qwizard.cpp.
Qt::TextFormat QWizard::subTitleFormat | ( | ) | const |
Definition at line 2854 of file qwizard.cpp.
bool QWizard::testOption | ( | WizardOption | option | ) | const |
Returns true
if the given option is enabled; otherwise, returns false.
Definition at line 2608 of file qwizard.cpp.
Qt::TextFormat QWizard::titleFormat | ( | ) | const |
Definition at line 2833 of file qwizard.cpp.
|
virtual |
This virtual function is called by QWizard when the user clicks \uicontrol Next or \uicontrol 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 \uicontrol Next or \uicontrol Finish button (by specifying \l{mandatory fields} or by reimplementing QWizardPage::isComplete()) than to reimplement validateCurrentPage().
Definition at line 3354 of file qwizard.cpp.
QList< int > QWizard::visitedIds | ( | ) | const |
Returns the list of IDs of visited pages, in the order in which the pages were visited.
Definition at line 2403 of file qwizard.cpp.
QWizard::WizardStyle QWizard::wizardStyle | ( | ) | const |
Definition at line 2583 of file qwizard.cpp.
|
read |
|
readwrite |
the various options that affect the look and feel of the wizard
By default, the following options are set (depending on the platform):
\list
|
readwrite |
|
readwrite |
the text format used by page subtitles
The default format is Qt::AutoText.
|
readwrite |
the text format used by page titles
The default format is Qt::AutoText.
|
readwrite |
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.