Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwizard.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWIZARD_H
5#define QWIZARD_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qdialog.h>
9
11
13
14class QAbstractButton;
15class QWizardPage;
16class QWizardPrivate;
17
18class Q_WIDGETS_EXPORT QWizard : public QDialog
19{
21 Q_PROPERTY(WizardStyle wizardStyle READ wizardStyle WRITE setWizardStyle)
22 Q_PROPERTY(WizardOptions options READ options WRITE setOptions)
23 Q_PROPERTY(Qt::TextFormat titleFormat READ titleFormat WRITE setTitleFormat)
24 Q_PROPERTY(Qt::TextFormat subTitleFormat READ subTitleFormat WRITE setSubTitleFormat)
25 Q_PROPERTY(int startId READ startId WRITE setStartId)
26 Q_PROPERTY(int currentId READ currentId WRITE setCurrentId NOTIFY currentIdChanged)
27
28public:
45
53
61 Q_ENUM(WizardStyle)
62
64 IndependentPages = 0x00000001,
65 IgnoreSubTitles = 0x00000002,
66 ExtendedWatermarkPixmap = 0x00000004,
67 NoDefaultButton = 0x00000008,
68 NoBackButtonOnStartPage = 0x00000010,
69 NoBackButtonOnLastPage = 0x00000020,
70 DisabledBackButtonOnLastPage = 0x00000040,
71 HaveNextButtonOnLastPage = 0x00000080,
72 HaveFinishButtonOnEarlyPages = 0x00000100,
73 NoCancelButton = 0x00000200,
74 CancelButtonOnLeft = 0x00000400,
75 HaveHelpButton = 0x00000800,
76 HelpButtonOnRight = 0x00001000,
77 HaveCustomButton1 = 0x00002000,
78 HaveCustomButton2 = 0x00004000,
79 HaveCustomButton3 = 0x00008000,
80 NoCancelButtonOnLastPage = 0x00010000
81 };
82 Q_ENUM(WizardOption)
83
84 Q_DECLARE_FLAGS(WizardOptions, WizardOption)
85 Q_FLAG(WizardOptions)
86
87 explicit QWizard(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
88 ~QWizard();
89
90 int addPage(QWizardPage *page);
91 void setPage(int id, QWizardPage *page);
92 void removePage(int id);
93 QWizardPage *page(int id) const;
94 bool hasVisitedPage(int id) const;
95 QList<int> visitedIds() const;
96 QList<int> pageIds() const;
97 void setStartId(int id);
98 int startId() const;
99 QWizardPage *currentPage() const;
100 int currentId() const;
101
102 virtual bool validateCurrentPage();
103 virtual int nextId() const;
104
105 void setField(const QString &name, const QVariant &value);
106 QVariant field(const QString &name) const;
107
108 void setWizardStyle(WizardStyle style);
109 WizardStyle wizardStyle() const;
110
111 void setOption(WizardOption option, bool on = true);
112 bool testOption(WizardOption option) const;
113 void setOptions(WizardOptions options);
114 WizardOptions options() const;
115
116 void setButtonText(WizardButton which, const QString &text);
117 QString buttonText(WizardButton which) const;
118 void setButtonLayout(const QList<WizardButton> &layout);
119 void setButton(WizardButton which, QAbstractButton *button);
120 QAbstractButton *button(WizardButton which) const;
121
122 void setTitleFormat(Qt::TextFormat format);
123 Qt::TextFormat titleFormat() const;
124 void setSubTitleFormat(Qt::TextFormat format);
125 Qt::TextFormat subTitleFormat() const;
126 void setPixmap(WizardPixmap which, const QPixmap &pixmap);
127 QPixmap pixmap(WizardPixmap which) const;
128
129 void setSideWidget(QWidget *widget);
130 QWidget *sideWidget() const;
131
132 void setDefaultProperty(const char *className, const char *property,
133 const char *changedSignal);
134
135 void setVisible(bool visible) override;
136 QSize sizeHint() const override;
137
139 void currentIdChanged(int id);
141 void customButtonClicked(int which);
142 void pageAdded(int id);
143 void pageRemoved(int id);
144
145public Q_SLOTS:
146 void back();
147 void next();
148 void setCurrentId(int id);
149 void restart();
150
151protected:
152 bool event(QEvent *event) override;
153 void resizeEvent(QResizeEvent *event) override;
154 void paintEvent(QPaintEvent *event) override;
155#if defined(Q_OS_WIN) || defined(Q_QDOC)
156 bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
157#endif
158 void done(int result) override;
159 virtual void initializePage(int id);
160 virtual void cleanupPage(int id);
161
162private:
163 Q_DISABLE_COPY(QWizard)
164 Q_DECLARE_PRIVATE(QWizard)
165 Q_PRIVATE_SLOT(d_func(), void _q_emitCustomButtonClicked())
166 Q_PRIVATE_SLOT(d_func(), void _q_updateButtonStates())
167 Q_PRIVATE_SLOT(d_func(), void _q_handleFieldObjectDestroyed(QObject *))
168
169 friend class QWizardPage;
170};
171
173
175
176class Q_WIDGETS_EXPORT QWizardPage : public QWidget
177{
180 Q_PROPERTY(QString subTitle READ subTitle WRITE setSubTitle)
181
182public:
183 explicit QWizardPage(QWidget *parent = nullptr);
184 ~QWizardPage();
185
186 void setTitle(const QString &title);
187 QString title() const;
188 void setSubTitle(const QString &subTitle);
189 QString subTitle() const;
190 void setPixmap(QWizard::WizardPixmap which, const QPixmap &pixmap);
191 QPixmap pixmap(QWizard::WizardPixmap which) const;
192 void setFinalPage(bool finalPage);
193 bool isFinalPage() const;
194 void setCommitPage(bool commitPage);
195 bool isCommitPage() const;
196 void setButtonText(QWizard::WizardButton which, const QString &text);
197 QString buttonText(QWizard::WizardButton which) const;
198
199 virtual void initializePage();
200 virtual void cleanupPage();
201 virtual bool validatePage();
202 virtual bool isComplete() const;
203 virtual int nextId() const;
204
206 void completeChanged();
207
208protected:
209 void setField(const QString &name, const QVariant &value);
210 QVariant field(const QString &name) const;
211 void registerField(const QString &name, QWidget *widget, const char *property = nullptr,
212 const char *changedSignal = nullptr);
213 QWizard *wizard() const;
214
215private:
216 Q_DISABLE_COPY(QWizardPage)
217 Q_DECLARE_PRIVATE(QWizardPage)
218 Q_PRIVATE_SLOT(d_func(), void _q_maybeEmitCompleteChanged())
219 Q_PRIVATE_SLOT(d_func(), void _q_updateCachedCompleteState())
220
221 friend class QWizard;
222 friend class QWizardPrivate;
223};
224
226
227#endif // QWIZARD_H
The QAbstractButton class is the abstract base class of button widgets, providing functionality commo...
\inmodule QtCore
Definition qbytearray.h:57
The QDialog class is the base class of dialog windows.
Definition qdialog.h:19
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtCore
Definition qobject.h:103
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:548
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
The QWizardPage class is the base class for wizard pages.
Definition qwizard.h:177
The QWizard class provides a framework for wizards.
Definition qwizard.h:19
WizardOption
This enum specifies various options that affect the look and feel of a wizard.
Definition qwizard.h:63
void helpRequested()
This signal is emitted when the user clicks the \uicontrol Help button.
void pageAdded(int id)
WizardPixmap
This enum specifies the pixmaps that can be associated with a page.
Definition qwizard.h:46
@ BackgroundPixmap
Definition qwizard.h:50
@ BannerPixmap
Definition qwizard.h:49
@ WatermarkPixmap
Definition qwizard.h:47
@ LogoPixmap
Definition qwizard.h:48
WizardStyle
This enum specifies the different looks supported by QWizard.
Definition qwizard.h:54
@ AeroStyle
Definition qwizard.h:58
@ ModernStyle
Definition qwizard.h:56
@ ClassicStyle
Definition qwizard.h:55
@ MacStyle
Definition qwizard.h:57
void pageRemoved(int id)
void currentIdChanged(int id)
This signal is emitted when the current page changes, with the new current id.
void customButtonClicked(int which)
This signal is emitted when the user clicks a custom button.
WizardButton
This enum specifies the buttons in a wizard.
Definition qwizard.h:29
@ CommitButton
Definition qwizard.h:32
@ BackButton
Definition qwizard.h:30
@ HelpButton
Definition qwizard.h:35
@ FinishButton
Definition qwizard.h:33
@ Stretch
Definition qwizard.h:39
@ CustomButton3
Definition qwizard.h:38
@ NextButton
Definition qwizard.h:31
@ CustomButton1
Definition qwizard.h:36
@ CancelButton
Definition qwizard.h:34
@ CustomButton2
Definition qwizard.h:37
QOpenGLWidget * widget
[1]
QString text
QPushButton * button
[2]
short next
Definition keywords.cpp:445
Combined button and popup list for selecting options.
Definition qcompare.h:63
TextFormat
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLbitfield flags
GLuint GLsizei const GLchar * message
GLuint name
GLint GLsizei GLsizei GLenum format
struct _cl_event * event
GLuint64EXT * result
[6]
GLuint GLenum option
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_FLAG(x)
#define Q_SLOTS
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
ptrdiff_t qintptr
Definition qtypes.h:166
static uint nextId
const char property[13]
Definition qwizard.cpp:101
const char className[16]
[1]
Definition qwizard.cpp:100
#define explicit
QVBoxLayout * layout
QString title
[35]
QByteArray page
[45]
widget render & pixmap
g setTitle("&User information")
[0]
imageLabel setPixmap(QPixmap::fromImage(image))