1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QWizard Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QWizard Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QWizard class provides a framework for wizards. <a href="#details">More...</a></p>
<p>Inherits <a href="qdialog.html">QDialog</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qwizard.html#WizardButton-enum">WizardButton</a></b> { BackButton, NextButton, CommitButton, FinishButton, ..., Stretch }</li><li><div class="fn" />enum <b><a href="qwizard.html#WizardOption-enum">WizardOption</a></b> { IndependentPages, IgnoreSubTitles, ExtendedWatermarkPixmap, NoDefaultButton, ..., HaveCustomButton3 }</li><li><div class="fn" />class <b><a href="qwizard-wizardoptions.html">WizardOptions</a></b></li><li><div class="fn" />enum <b><a href="qwizard.html#WizardPixmap-enum">WizardPixmap</a></b> { WatermarkPixmap, LogoPixmap, BannerPixmap, BackgroundPixmap }</li><li><div class="fn" />enum <b><a href="qwizard.html#WizardStyle-enum">WizardStyle</a></b> { ClassicStyle, ModernStyle, MacStyle, AeroStyle }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qwizard.html#QWizard">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None, Qt.WindowFlags <i>flags</i> = 0)</li><li><div class="fn" />int <b><a href="qwizard.html#addPage">addPage</a></b> (<i>self</i>, QWizardPage)</li><li><div class="fn" /><b><a href="qwizard.html#back">back</a></b> (<i>self</i>)</li><li><div class="fn" />QAbstractButton <b><a href="qwizard.html#button">button</a></b> (<i>self</i>, WizardButton)</li><li><div class="fn" />QString <b><a href="qwizard.html#buttonText">buttonText</a></b> (<i>self</i>, WizardButton)</li><li><div class="fn" /><b><a href="qwizard.html#cleanupPage">cleanupPage</a></b> (<i>self</i>, int)</li><li><div class="fn" />int <b><a href="qwizard.html#currentId">currentId</a></b> (<i>self</i>)</li><li><div class="fn" />QWizardPage <b><a href="qwizard.html#currentPage">currentPage</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwizard.html#done">done</a></b> (<i>self</i>, int)</li><li><div class="fn" />bool <b><a href="qwizard.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />QVariant <b><a href="qwizard.html#field">field</a></b> (<i>self</i>, QString)</li><li><div class="fn" />bool <b><a href="qwizard.html#hasVisitedPage">hasVisitedPage</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qwizard.html#initializePage">initializePage</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qwizard.html#next">next</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qwizard.html#nextId">nextId</a></b> (<i>self</i>)</li><li><div class="fn" />WizardOptions <b><a href="qwizard.html#options">options</a></b> (<i>self</i>)</li><li><div class="fn" />QWizardPage <b><a href="qwizard.html#page">page</a></b> (<i>self</i>, int)</li><li><div class="fn" />list-of-int <b><a href="qwizard.html#pageIds">pageIds</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwizard.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" />QPixmap <b><a href="qwizard.html#pixmap">pixmap</a></b> (<i>self</i>, WizardPixmap)</li><li><div class="fn" /><b><a href="qwizard.html#removePage">removePage</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qwizard.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qwizard.html#restart">restart</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qwizard.html#setButton">setButton</a></b> (<i>self</i>, WizardButton, QAbstractButton)</li><li><div class="fn" /><b><a href="qwizard.html#setButtonLayout">setButtonLayout</a></b> (<i>self</i>, list-of-QWizard.WizardButton)</li><li><div class="fn" /><b><a href="qwizard.html#setButtonText">setButtonText</a></b> (<i>self</i>, WizardButton, QString)</li><li><div class="fn" /><b><a href="qwizard.html#setDefaultProperty">setDefaultProperty</a></b> (<i>self</i>, str, str, str)</li><li><div class="fn" /><b><a href="qwizard.html#setField">setField</a></b> (<i>self</i>, QString, QVariant)</li><li><div class="fn" /><b><a href="qwizard.html#setOption">setOption</a></b> (<i>self</i>, WizardOption, bool <i>on</i> = True)</li><li><div class="fn" /><b><a href="qwizard.html#setOptions">setOptions</a></b> (<i>self</i>, WizardOptions)</li><li><div class="fn" /><b><a href="qwizard.html#setPage">setPage</a></b> (<i>self</i>, int, QWizardPage)</li><li><div class="fn" /><b><a href="qwizard.html#setPixmap">setPixmap</a></b> (<i>self</i>, WizardPixmap, QPixmap)</li><li><div class="fn" /><b><a href="qwizard.html#setStartId">setStartId</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qwizard.html#setSubTitleFormat">setSubTitleFormat</a></b> (<i>self</i>, Qt.TextFormat)</li><li><div class="fn" /><b><a href="qwizard.html#setTitleFormat">setTitleFormat</a></b> (<i>self</i>, Qt.TextFormat)</li><li><div class="fn" /><b><a href="qwizard.html#setVisible">setVisible</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qwizard.html#setWizardStyle">setWizardStyle</a></b> (<i>self</i>, WizardStyle)</li><li><div class="fn" />QSize <b><a href="qwizard.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qwizard.html#startId">startId</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.TextFormat <b><a href="qwizard.html#subTitleFormat">subTitleFormat</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qwizard.html#testOption">testOption</a></b> (<i>self</i>, WizardOption)</li><li><div class="fn" />Qt.TextFormat <b><a href="qwizard.html#titleFormat">titleFormat</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qwizard.html#validateCurrentPage">validateCurrentPage</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-int <b><a href="qwizard.html#visitedPages">visitedPages</a></b> (<i>self</i>)</li><li><div class="fn" />WizardStyle <b><a href="qwizard.html#wizardStyle">wizardStyle</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qwizard.html#currentIdChanged">currentIdChanged</a></b> (int)</li><li><div class="fn" />void <b><a href="qwizard.html#customButtonClicked">customButtonClicked</a></b> (int)</li><li><div class="fn" />void <b><a href="qwizard.html#helpRequested">helpRequested</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QWizard class provides a framework for wizards.</p>
<p>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.</p>
<p>QWizard inherits <a href="qdialog.html">QDialog</a> and represents a wizard. Each page is a <a href="qwizardpage.html">QWizardPage</a> (a <a href="qwidget.html">QWidget</a> subclass). To create your own wizards, you can use these classes directly, or you can subclass them for more control.</p>
<p>Topics:</p>
<ul><li><a href="#a-trivial-example">A Trivial Example</a></li>
<li><a href="#wizard-look-and-feel">Wizard Look and Feel</a></li>
<li><a href="#elements-of-a-wizard-page">Elements of a Wizard Page</a></li>
<li><a href="#registering-and-using-fields">Registering and Using Fields</a></li>
<li><a href="#creating-linear-wizards">Creating Linear Wizards</a></li>
<li><a href="#creating-non-linear-wizards">Creating Non-Linear Wizards</a></li>
</ul>
<a name="a-trivial-example" />
<h3>A Trivial Example</h3>
<p>The following example illustrates how to create wizard pages and add them to a wizard. For more advanced examples, see <a href="dialogs-classwizard.html">Class Wizard</a> and <a href="dialogs-licensewizard.html">License Wizard</a>.</p>
<pre> QWizardPage *createIntroPage()
{
QWizardPage *page = new QWizardPage;
page->setTitle("Introduction");
QLabel *label = new QLabel("This wizard will help you register your copy "
"of Super Product Two.");
label->setWordWrap(true);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(label);
page->setLayout(layout);
return page;
}
QWizardPage *createRegistrationPage()
{
...
}
QWizardPage *createConclusionPage()
{
...
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QString translatorFileName = QLatin1String("qt_");
translatorFileName += QLocale.system().name();
QTranslator *translator = new QTranslator(&app);
if (translator->load(translatorFileName, QLibraryInfo.location(QLibraryInfo.TranslationsPath)))
app.installTranslator(translator);
QWizard wizard;
wizard.addPage(createIntroPage());
wizard.addPage(createRegistrationPage());
wizard.addPage(createConclusionPage());
wizard.setWindowTitle("Trivial Wizard");
wizard.show();
return app.exec();
}</pre>
<a name="wizard-look-and-feel" />
<h3>Wizard Look and Feel</h3>
<p>QWizard supports four wizard looks:</p>
<ul>
<li><a href="qwizard.html#WizardStyle-enum">ClassicStyle</a></li>
<li><a href="qwizard.html#WizardStyle-enum">ModernStyle</a></li>
<li><a href="qwizard.html#WizardStyle-enum">MacStyle</a></li>
<li><a href="qwizard.html#WizardStyle-enum">AeroStyle</a></li>
</ul>
<p>You can explicitly set the look to use using <a href="qwizard.html#wizardStyle-prop">setWizardStyle</a>() (e.g., if you want the same look on all platforms).</p>
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic">
<thead><tr class="qt-style" valign="top"><th><a href="qwizard.html#WizardStyle-enum">ClassicStyle</a></th><th><a href="qwizard.html#WizardStyle-enum">ModernStyle</a></th><th><a href="qwizard.html#WizardStyle-enum">MacStyle</a></th><th><a href="qwizard.html#WizardStyle-enum">AeroStyle</a></th></tr></thead>
<tr class="odd" valign="top"><td><img src="images/qtwizard-classic1.png" /></td><td><img src="images/qtwizard-modern1.png" /></td><td><img src="images/qtwizard-mac1.png" /></td><td><img src="images/qtwizard-aero1.png" /></td></tr>
<tr class="even" valign="top"><td><img src="images/qtwizard-classic2.png" /></td><td><img src="images/qtwizard-modern2.png" /></td><td><img src="images/qtwizard-mac2.png" /></td><td><img src="images/qtwizard-aero2.png" /></td></tr>
</table></p>
<p>Note: <a href="qwizard.html#WizardStyle-enum">AeroStyle</a> has effect only on a Windows Vista system with alpha compositing enabled. <a href="qwizard.html#WizardStyle-enum">ModernStyle</a> is used as a fallback when this condition is not met.</p>
<p>In addition to the wizard style, there are several options that control the look and feel of the wizard. These can be set using <a href="qwizard.html#setOption">setOption</a>() or <a href="qwizard.html#options-prop">setOptions</a>(). For example, <a href="qwizard.html#WizardOption-enum">HaveHelpButton</a> makes QWizard show a <b>Help</b> button along with the other wizard buttons.</p>
<p>You can even change the order of the wizard buttons to any arbitrary order using <a href="qwizard.html#setButtonLayout">setButtonLayout</a>(), and you can add up to three custom buttons (e.g., a <b>Print</b> button) to the button row. This is achieved by calling <a href="qwizard.html#setButton">setButton</a>() or <a href="qwizard.html#setButtonText">setButtonText</a>() with <a href="qwizard.html#WizardButton-enum">CustomButton1</a>, <a href="qwizard.html#WizardButton-enum">CustomButton2</a>, or <a href="qwizard.html#WizardButton-enum">CustomButton3</a> to set up the button, and by enabling the <a href="qwizard.html#WizardOption-enum">HaveCustomButton1</a>, <a href="qwizard.html#WizardOption-enum">HaveCustomButton2</a>, or <a href="qwizard.html#WizardOption-enum">HaveCustomButton3</a> options. Whenever the user clicks a custom button, <a href="qwizard.html#customButtonClicked">customButtonClicked</a>() is emitted. For example:</p>
<pre> wizard()->setButtonText(QWizard.CustomButton1, tr("&Print"));
wizard()->setOption(QWizard.HaveCustomButton1, true);
connect(wizard(), SIGNAL(customButtonClicked(int)),
this, SLOT(printButtonClicked()));</pre>
<a name="elements-of-a-wizard-page" />
<h3>Elements of a Wizard Page</h3>
<p>Wizards consist of a sequence of <a href="qwizardpage.html">QWizardPage</a>s. At any time, only one page is shown. A page has the following attributes:</p>
<ul>
<li>A <a href="qwizardpage.html#title-prop">title</a>.</li>
<li>A <a href="qwizardpage.html#subTitle-prop">subTitle</a>.</li>
<li>A set of pixmaps, which may or may not be honored, depending on the wizard's style:<ul>
<li><a href="qwizard.html#WizardPixmap-enum">WatermarkPixmap</a> (used by <a href="qwizard.html#WizardStyle-enum">ClassicStyle</a> and <a href="qwizard.html#WizardStyle-enum">ModernStyle</a>)</li>
<li><a href="qwizard.html#WizardPixmap-enum">BannerPixmap</a> (used by <a href="qwizard.html#WizardStyle-enum">ModernStyle</a>)</li>
<li><a href="qwizard.html#WizardPixmap-enum">LogoPixmap</a> (used by <a href="qwizard.html#WizardStyle-enum">ClassicStyle</a> and <a href="qwizard.html#WizardStyle-enum">ModernStyle</a>)</li>
<li><a href="qwizard.html#WizardPixmap-enum">BackgroundPixmap</a> (used by <a href="qwizard.html#WizardStyle-enum">MacStyle</a>)</li>
</ul>
</li>
</ul>
<p>The diagram belows shows how QWizard renders these attributes, assuming they are all present and <a href="qwizard.html#WizardStyle-enum">ModernStyle</a> is used:</p>
<p align="center"><img src="images/qtwizard-nonmacpage.png" /></p><p>When a <a href="qwizardpage.html#subTitle-prop">subTitle</a> is set, QWizard displays it in a header, in which case it also uses the <a href="qwizard.html#WizardPixmap-enum">BannerPixmap</a> and the <a href="qwizard.html#WizardPixmap-enum">LogoPixmap</a> to decorate the header. The <a href="qwizard.html#WizardPixmap-enum">WatermarkPixmap</a> 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.</p>
<p>The page itself (the <a href="qwizardpage.html">QWizardPage</a> widget) occupies the area between the header, the watermark, and the button row. Typically, the page is a <a href="qwizardpage.html">QWizardPage</a> on which a <a href="qgridlayout.html">QGridLayout</a> is installed, with standard child widgets (<a href="qlabel.html">QLabel</a>s, <a href="qlineedit.html">QLineEdit</a>s, etc.).</p>
<p>If the wizard's style is <a href="qwizard.html#WizardStyle-enum">MacStyle</a>, the page looks radically different:</p>
<p align="center"><img src="images/qtwizard-macpage.png" /></p><p>The watermark, banner, and logo pixmaps are ignored by the <a href="qwizard.html#WizardStyle-enum">MacStyle</a>. If the <a href="qwizard.html#WizardPixmap-enum">BackgroundPixmap</a> is set, it is used as the background for the wizard; otherwise, a default "assistant" image is used.</p>
<p>The title and subtitle are set by calling <a href="qwizardpage.html#title-prop">QWizardPage.setTitle</a>() and <a href="qwizardpage.html#subTitle-prop">QWizardPage.setSubTitle</a>() on the individual pages. They may be plain text or HTML (see <a href="qwizard.html#titleFormat-prop">titleFormat</a> and <a href="qwizard.html#subTitleFormat-prop">subTitleFormat</a>). The pixmaps can be set globally for the entire wizard using <a href="qwizard.html#setPixmap">setPixmap</a>(), or on a per-page basis using <a href="qwizardpage.html#setPixmap">QWizardPage.setPixmap</a>().</p>
<a name="field-mechanism" /><a name="registering-and-using-fields" />
<h3>Registering and Using Fields</h3>
<p>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 <a href="qlineedit.html">QLineEdit</a>) 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).</p>
<p>To register a field, call <a href="qwizardpage.html#registerField">QWizardPage.registerField</a>() field. For example:</p>
<pre> ClassInfoPage.ClassInfoPage(QWidget *parent)
: QWizardPage(parent)
{
...
classNameLabel = new QLabel(tr("&Class name:"));
classNameLineEdit = new QLineEdit;
classNameLabel->setBuddy(classNameLineEdit);
baseClassLabel = new QLabel(tr("B&ase class:"));
baseClassLineEdit = new QLineEdit;
baseClassLabel->setBuddy(baseClassLineEdit);
qobjectMacroCheckBox = new QCheckBox(tr("Generate Q_OBJECT &macro"));
registerField("className*", classNameLineEdit);
registerField("baseClass", baseClassLineEdit);
registerField("qobjectMacro", qobjectMacroCheckBox);
...
}</pre>
<p>The above code registers three fields, <tt>className</tt>, <tt>baseClass</tt>, and <tt>qobjectMacro</tt>, which are associated with three child widgets. The asterisk (<tt>*</tt>) next to <tt>className</tt> denotes a mandatory field.</p>
<a name="initialize-page" /><p>The fields of any page are accessible from any other page. For example:</p>
<pre> void OutputFilesPage.initializePage()
{
QString className = field("className").toString();
headerLineEdit->setText(className.toLower() + ".h");
implementationLineEdit->setText(className.toLower() + ".cpp");
outputDirLineEdit->setText(QDir.convertSeparators(QDir.tempPath()));
}</pre>
<p>Here, we call <a href="qwizardpage.html#field">QWizardPage.field</a>() to access the contents of the <tt>className</tt> field (which was defined in the <tt>ClassInfoPage</tt>) and use it to initialize the <tt>OuputFilePage</tt>. The field's contents is returned as a <a href="qvariant.html">QVariant</a>.</p>
<p>When we create a field using <a href="qwizardpage.html#registerField">QWizardPage.registerField</a>(), 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 <a href="qlineedit.html">QLineEdit</a>, <a href="qcheckbox.html">QCheckBox</a>, and <a href="qcombobox.html">QComboBox</a>, because QWizard knows which properties to look for.</p>
<a name="mandatory-fields" /><p>If an asterisk (<tt>*</tt>) is appended to the name when the property is registered, the field is a <i>mandatory field</i>. When a page has mandatory fields, the <b>Next</b> and/or <b>Finish</b> buttons are enabled only when all mandatory fields are filled.</p>
<p>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 <a href="qwizard.html#initializePage">initializePage</a>() was called). For <a href="qlineedit.html">QLineEdit</a> and <a href="qabstractspinbox.html">QAbstractSpinBox</a> subclasses, QWizard also checks that <a href="qlineedit.html#acceptableInput-prop">hasAcceptableInput()</a> returns true, to honor any validator or mask.</p>
<p>QWizard's mandatory field mechanism is provided for convenience. A more powerful (but also more cumbersome) alternative is to reimplement <a href="qwizardpage.html#isComplete">QWizardPage.isComplete</a>() and to emit the <a href="qwizardpage.html#completeChanged">QWizardPage.completeChanged</a>() signal whenever the page becomes complete or incomplete.</p>
<p>The enabled/disabled state of the <b>Next</b> and/or <b>Finish</b> buttons is one way to perform validation on the user input. Another way is to reimplement <a href="qwizard.html#validateCurrentPage">validateCurrentPage</a>() (or <a href="qwizardpage.html#validatePage">QWizardPage.validatePage</a>()) 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.</p>
<a name="creating-linear-wizards" />
<h3>Creating Linear Wizards</h3>
<p>Most wizards have a linear structure, with page 1 followed by page 2 and so on until the last page. The <a href="dialogs-classwizard.html">Class Wizard</a> example is such a wizard. With QWizard, linear wizards are created by instantiating the <a href="qwizardpage.html">QWizardPage</a>s and inserting them using <a href="qwizard.html#addPage">addPage</a>(). By default, the pages are shown in the order in which they were added. For example:</p>
<pre> ClassWizard.ClassWizard(QWidget *parent)
: QWizard(parent)
{
addPage(new IntroPage);
addPage(new ClassInfoPage);
addPage(new CodeStylePage);
addPage(new OutputFilesPage);
addPage(new ConclusionPage);
...
}</pre>
<p>When a page is about to be shown, QWizard calls <a href="qwizard.html#initializePage">initializePage</a>() (which in turn calls <a href="qwizardpage.html#initializePage">QWizardPage.initializePage</a>()) 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 <a href="#initialize-page">example above</a>).</p>
<p>If the user presses <b>Back</b>, <a href="qwizard.html#cleanupPage">cleanupPage</a>() is called (which in turn calls <a href="qwizardpage.html#cleanupPage">QWizardPage.cleanupPage</a>()). The default implementation resets the page's fields to their original values (the values they had before <a href="qwizard.html#initializePage">initializePage</a>() was called). If you want the <b>Back</b> button to be non-destructive and keep the values entered by the user, simply enable the <a href="qwizard.html#WizardOption-enum">IndependentPages</a> option.</p>
<a name="creating-non-linear-wizards" />
<h3>Creating Non-Linear Wizards</h3>
<p>Some wizards are more complex in that they allow different traversal paths based on the information provided by the user. The <a href="dialogs-licensewizard.html">License Wizard</a> example illustrates this. It provides five wizard pages; depending on which options are selected, the user can reach different pages.</p>
<p align="center"><img src="images/licensewizard-flow.png" /></p><p>In complex wizards, pages are identified by IDs. These IDs are typically defined using an enum. For example:</p>
<pre> class LicenseWizard : public QWizard
{
...
enum { Page_Intro, Page_Evaluate, Page_Register, Page_Details,
Page_Conclusion };
...
};</pre>
<p>The pages are inserted using <a href="qwizard.html#setPage">setPage</a>(), which takes an ID and an instance of <a href="qwizardpage.html">QWizardPage</a> (or of a subclass):</p>
<pre> LicenseWizard.LicenseWizard(QWidget *parent)
: QWizard(parent)
{
setPage(Page_Intro, new IntroPage);
setPage(Page_Evaluate, new EvaluatePage);
setPage(Page_Register, new RegisterPage);
setPage(Page_Details, new DetailsPage);
setPage(Page_Conclusion, new ConclusionPage);
...
}</pre>
<p>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 <a href="qwizardpage.html#nextId">QWizardPage.nextId</a>(). For example:</p>
<pre> int IntroPage.nextId() const
{
if (evaluateRadioButton->isChecked()) {
return LicenseWizard.Page_Evaluate;
} else {
return LicenseWizard.Page_Register;
}
}
int EvaluatePage.nextId() const
{
return LicenseWizard.Page_Conclusion;
}
int RegisterPage.nextId() const
{
if (upgradeKeyLineEdit->text().isEmpty()) {
return LicenseWizard.Page_Details;
} else {
return LicenseWizard.Page_Conclusion;
}
}
int DetailsPage.nextId() const
{
return LicenseWizard.Page_Conclusion;
}
int ConclusionPage.nextId() const
{
return -1;
}</pre>
<p>It would also be possible to put all the logic in one place, in a <a href="qwizard.html#nextId">QWizard.nextId</a>() reimplementation. For example:</p>
<pre> int LicenseWizard.nextId() const
{
switch (currentId()) {
case Page_Intro:
if (field("intro.evaluate").toBool()) {
return Page_Evaluate;
} else {
return Page_Register;
}
case Page_Evaluate:
return Page_Conclusion;
case Page_Register:
if (field("register.upgradeKey").toString().isEmpty()) {
return Page_Details;
} else {
return Page_Conclusion;
}
case Page_Details:
return Page_Conclusion;
case Page_Conclusion:
default:
return -1;
}
}</pre>
<p>To start at another page than the page with the lowest ID, call <a href="qwizard.html#startId-prop">setStartId</a>().</p>
<p>To test whether a page has been visited or not, call <a href="qwizard.html#hasVisitedPage">hasVisitedPage</a>(). For example:</p>
<pre> void ConclusionPage.initializePage()
{
QString licenseText;
if (wizard()->hasVisitedPage(LicenseWizard.Page_Evaluate)) {
licenseText = tr("<u>Evaluation License Agreement:</u> "
"You can use this software for 30 days and make one "
"backup, but you are not allowed to distribute it.");
} else if (wizard()->hasVisitedPage(LicenseWizard.Page_Details)) {
licenseText = tr("<u>First-Time License Agreement:</u> "
"You can use this software subject to the license "
"you will receive by email.");
} else {
licenseText = tr("<u>Upgrade License Agreement:</u> "
"This software is licensed under the terms of your "
"current license.");
}
bottomLabel->setText(licenseText);
}</pre>
<p>See also <a href="qwizardpage.html">QWizardPage</a>, <a href="dialogs-classwizard.html">Class Wizard Example</a>, and <a href="dialogs-licensewizard.html">License Wizard Example</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="WizardButton-enum" />QWizard.WizardButton</h3><p>This enum specifies the buttons in a wizard.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QWizard.BackButton</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The <b>Back</b> button (<b>Go Back</b> on Mac OS X)</td></tr>
<tr><td valign="top"><tt>QWizard.NextButton</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The <b>Next</b> button (<b>Continue</b> on Mac OS X)</td></tr>
<tr><td valign="top"><tt>QWizard.CommitButton</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The <b>Commit</b> button</td></tr>
<tr><td valign="top"><tt>QWizard.FinishButton</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">The <b>Finish</b> button (<b>Done</b> on Mac OS X)</td></tr>
<tr><td valign="top"><tt>QWizard.CancelButton</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">The <b>Cancel</b> button (see also <a href="qwizard.html#WizardOption-enum">NoCancelButton</a>)</td></tr>
<tr><td valign="top"><tt>QWizard.HelpButton</tt></td><td align="center" valign="top"><tt>5</tt></td><td valign="top">The <b>Help</b> button (see also <a href="qwizard.html#WizardOption-enum">HaveHelpButton</a>)</td></tr>
<tr><td valign="top"><tt>QWizard.CustomButton1</tt></td><td align="center" valign="top"><tt>6</tt></td><td valign="top">The first user-defined button (see also <a href="qwizard.html#WizardOption-enum">HaveCustomButton1</a>)</td></tr>
<tr><td valign="top"><tt>QWizard.CustomButton2</tt></td><td align="center" valign="top"><tt>7</tt></td><td valign="top">The second user-defined button (see also <a href="qwizard.html#WizardOption-enum">HaveCustomButton2</a>)</td></tr>
<tr><td valign="top"><tt>QWizard.CustomButton3</tt></td><td align="center" valign="top"><tt>8</tt></td><td valign="top">The third user-defined button (see also <a href="qwizard.html#WizardOption-enum">HaveCustomButton3</a>)</td></tr>
</table></p>
<p>The following value is only useful when calling <a href="qwizard.html#setButtonLayout">setButtonLayout</a>():</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QWizard.Stretch</tt></td><td align="center" valign="top"><tt>9</tt></td><td valign="top">A horizontal stretch in the button layout</td></tr>
</table></p>
<p>See also <a href="qwizard.html#setButton">setButton</a>(), <a href="qwizard.html#setButtonText">setButtonText</a>(), <a href="qwizard.html#setButtonLayout">setButtonLayout</a>(), and <a href="qwizard.html#customButtonClicked">customButtonClicked</a>().</p>
<a name="//apple_ref/cpp/tag/QWizard/WizardOption" />
<a name="//apple_ref/cpp/econst/QWizard/IndependentPages" />
<a name="//apple_ref/cpp/econst/QWizard/IgnoreSubTitles" />
<a name="//apple_ref/cpp/econst/QWizard/ExtendedWatermarkPixmap" />
<a name="//apple_ref/cpp/econst/QWizard/NoDefaultButton" />
<a name="//apple_ref/cpp/econst/QWizard/NoBackButtonOnStartPage" />
<a name="//apple_ref/cpp/econst/QWizard/NoBackButtonOnLastPage" />
<a name="//apple_ref/cpp/econst/QWizard/DisabledBackButtonOnLastPage" />
<a name="//apple_ref/cpp/econst/QWizard/HaveNextButtonOnLastPage" />
<a name="//apple_ref/cpp/econst/QWizard/HaveFinishButtonOnEarlyPages" />
<a name="//apple_ref/cpp/econst/QWizard/NoCancelButton" />
<a name="//apple_ref/cpp/econst/QWizard/CancelButtonOnLeft" />
<a name="//apple_ref/cpp/econst/QWizard/HaveHelpButton" />
<a name="//apple_ref/cpp/econst/QWizard/HelpButtonOnRight" />
<a name="//apple_ref/cpp/econst/QWizard/HaveCustomButton1" />
<a name="//apple_ref/cpp/econst/QWizard/HaveCustomButton2" />
<a name="//apple_ref/cpp/econst/QWizard/HaveCustomButton3" />
<a name="//apple_ref/cpp/tdef/QWizard/WizardOptions" />
<h3 class="fn"><a name="WizardOption-enum" />QWizard.WizardOption</h3><p>This enum specifies various options that affect the look and feel of a wizard.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QWizard.IndependentPages</tt></td><td align="center" valign="top"><tt>0x00000001</tt></td><td valign="top">The pages are independent of each other (i.e., they don't derive values from each other).</td></tr>
<tr><td valign="top"><tt>QWizard.IgnoreSubTitles</tt></td><td align="center" valign="top"><tt>0x00000002</tt></td><td valign="top">Don't show any subtitles, even if they are set.</td></tr>
<tr><td valign="top"><tt>QWizard.ExtendedWatermarkPixmap</tt></td><td align="center" valign="top"><tt>0x00000004</tt></td><td valign="top">Extend any <a href="qwizard.html#WizardPixmap-enum">WatermarkPixmap</a> all the way down to the window's edge.</td></tr>
<tr><td valign="top"><tt>QWizard.NoDefaultButton</tt></td><td align="center" valign="top"><tt>0x00000008</tt></td><td valign="top">Don't make the <b>Next</b> or <b>Finish</b> button the dialog's <a href="qpushbutton.html#default-prop">default button</a>.</td></tr>
<tr><td valign="top"><tt>QWizard.NoBackButtonOnStartPage</tt></td><td align="center" valign="top"><tt>0x00000010</tt></td><td valign="top">Don't show the <b>Back</b> button on the start page.</td></tr>
<tr><td valign="top"><tt>QWizard.NoBackButtonOnLastPage</tt></td><td align="center" valign="top"><tt>0x00000020</tt></td><td valign="top">Don't show the <b>Back</b> button on the last page.</td></tr>
<tr><td valign="top"><tt>QWizard.DisabledBackButtonOnLastPage</tt></td><td align="center" valign="top"><tt>0x00000040</tt></td><td valign="top">Disable the <b>Back</b> button on the last page.</td></tr>
<tr><td valign="top"><tt>QWizard.HaveNextButtonOnLastPage</tt></td><td align="center" valign="top"><tt>0x00000080</tt></td><td valign="top">Show the (disabled) <b>Next</b> button on the last page.</td></tr>
<tr><td valign="top"><tt>QWizard.HaveFinishButtonOnEarlyPages</tt></td><td align="center" valign="top"><tt>0x00000100</tt></td><td valign="top">Show the (disabled) <b>Finish</b> button on non-final pages.</td></tr>
<tr><td valign="top"><tt>QWizard.NoCancelButton</tt></td><td align="center" valign="top"><tt>0x00000200</tt></td><td valign="top">Don't show the <b>Cancel</b> button.</td></tr>
<tr><td valign="top"><tt>QWizard.CancelButtonOnLeft</tt></td><td align="center" valign="top"><tt>0x00000400</tt></td><td valign="top">Put the <b>Cancel</b> button on the left of <b>Back</b> (rather than on the right of <b>Finish</b> or <b>Next</b>).</td></tr>
<tr><td valign="top"><tt>QWizard.HaveHelpButton</tt></td><td align="center" valign="top"><tt>0x00000800</tt></td><td valign="top">Show the <b>Help</b> button.</td></tr>
<tr><td valign="top"><tt>QWizard.HelpButtonOnRight</tt></td><td align="center" valign="top"><tt>0x00001000</tt></td><td valign="top">Put the <b>Help</b> button on the far right of the button layout (rather than on the far left).</td></tr>
<tr><td valign="top"><tt>QWizard.HaveCustomButton1</tt></td><td align="center" valign="top"><tt>0x00002000</tt></td><td valign="top">Show the first user-defined button (<a href="qwizard.html#WizardButton-enum">CustomButton1</a>).</td></tr>
<tr><td valign="top"><tt>QWizard.HaveCustomButton2</tt></td><td align="center" valign="top"><tt>0x00004000</tt></td><td valign="top">Show the second user-defined button (<a href="qwizard.html#WizardButton-enum">CustomButton2</a>).</td></tr>
<tr><td valign="top"><tt>QWizard.HaveCustomButton3</tt></td><td align="center" valign="top"><tt>0x00008000</tt></td><td valign="top">Show the third user-defined button (<a href="qwizard.html#WizardButton-enum">CustomButton3</a>).</td></tr>
</table></p>
<p>The WizardOptions type is a typedef for <a href="qflags.html">QFlags</a><WizardOption>. It stores an OR combination of WizardOption values.</p>
<p>See also <a href="qwizard.html#options-prop">setOptions</a>(), <a href="qwizard.html#setOption">setOption</a>(), and <a href="qwizard.html#testOption">testOption</a>().</p>
<a name="//apple_ref/cpp/tag/QWizard/WizardPixmap" />
<a name="//apple_ref/cpp/econst/QWizard/WatermarkPixmap" />
<a name="//apple_ref/cpp/econst/QWizard/LogoPixmap" />
<a name="//apple_ref/cpp/econst/QWizard/BannerPixmap" />
<a name="//apple_ref/cpp/econst/QWizard/BackgroundPixmap" />
<a name="//apple_ref/cpp/econst/QWizard/NPixmaps" />
<h3 class="fn"><a name="WizardPixmap-enum" />QWizard.WizardPixmap</h3><p>This enum specifies the pixmaps that can be associated with a page.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QWizard.WatermarkPixmap</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The tall pixmap on the left side of a <a href="qwizard.html#WizardStyle-enum">ClassicStyle</a> or <a href="qwizard.html#WizardStyle-enum">ModernStyle</a> page</td></tr>
<tr><td valign="top"><tt>QWizard.LogoPixmap</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The small pixmap on the right side of a <a href="qwizard.html#WizardStyle-enum">ClassicStyle</a> or <a href="qwizard.html#WizardStyle-enum">ModernStyle</a> page header</td></tr>
<tr><td valign="top"><tt>QWizard.BannerPixmap</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The pixmap that occupies the background of a <a href="qwizard.html#WizardStyle-enum">ModernStyle</a> page header</td></tr>
<tr><td valign="top"><tt>QWizard.BackgroundPixmap</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">The pixmap that occupies the background of a <a href="qwizard.html#WizardStyle-enum">MacStyle</a> wizard</td></tr>
</table></p>
<p>See also <a href="qwizard.html#setPixmap">setPixmap</a>(), <a href="qwizardpage.html#setPixmap">QWizardPage.setPixmap</a>(), and <a href="qwizard.html#elements-of-a-wizard-page">Elements of a Wizard Page</a>.</p>
<a name="//apple_ref/cpp/tag/QWizard/WizardStyle" />
<a name="//apple_ref/cpp/econst/QWizard/ClassicStyle" />
<a name="//apple_ref/cpp/econst/QWizard/ModernStyle" />
<a name="//apple_ref/cpp/econst/QWizard/MacStyle" />
<a name="//apple_ref/cpp/econst/QWizard/AeroStyle" />
<a name="//apple_ref/cpp/econst/QWizard/NStyles" />
<h3 class="fn"><a name="WizardStyle-enum" />QWizard.WizardStyle</h3><p>This enum specifies the different looks supported by <a href="qwizard.html">QWizard</a>.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QWizard.ClassicStyle</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Classic Windows look</td></tr>
<tr><td valign="top"><tt>QWizard.ModernStyle</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Modern Windows look</td></tr>
<tr><td valign="top"><tt>QWizard.MacStyle</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Mac OS X look</td></tr>
<tr><td valign="top"><tt>QWizard.AeroStyle</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Windows Aero look</td></tr>
</table></p>
<p>See also <a href="qwizard.html#wizardStyle-prop">setWizardStyle</a>(), <a href="qwizard.html#WizardOption-enum">WizardOption</a>, and <a href="qwizard.html#wizard-look-and-feel">Wizard Look and Feel</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QWizard" />QWizard.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None, <a href="qt-windowflags.html">Qt.WindowFlags</a> <i>flags</i> = 0)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a wizard with the given <i>parent</i> and window <i>flags</i>.</p>
<p>See also <a href="qobject.html#parent">parent</a>() and <a href="qwidget.html#windowFlags-prop">windowFlags</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/~QWizard" />
<h3 class="fn"><a name="addPage" />int QWizard.addPage (<i>self</i>, <a href="qwizardpage.html">QWizardPage</a>)</h3><p>The <i>QWizardPage</i> argument has it's ownership transferred to Qt.</p><p>Adds the given <i>page</i> to the wizard, and returns the page's ID.</p>
<p>The ID is guaranteed to be larger than any other ID in the <a href="qwizard.html">QWizard</a> so far.</p>
<p>See also <a href="qwizard.html#setPage">setPage</a>() and <a href="qwizard.html#page">page</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/back" />
<h3 class="fn"><a name="back" />QWizard.back (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void back()</tt>.</p><p>Goes back to the previous page.</p>
<p>This is equivalent to pressing the <b>Back</b> button.</p>
<p>See also <a href="qwizard.html#next">next</a>(), <a href="qdialog.html#accept">accept</a>(), <a href="qdialog.html#reject">reject</a>(), and <a href="qwizard.html#restart">restart</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/button" />
<h3 class="fn"><a name="button" /><a href="qabstractbutton.html">QAbstractButton</a> QWizard.button (<i>self</i>, <a href="qwizard.html#WizardButton-enum">WizardButton</a>)</h3><p>Returns the button corresponding to role <i>which</i>.</p>
<p>See also <a href="qwizard.html#setButton">setButton</a>() and <a href="qwizard.html#setButtonText">setButtonText</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/buttonText" />
<h3 class="fn"><a name="buttonText" />QString QWizard.buttonText (<i>self</i>, <a href="qwizard.html#WizardButton-enum">WizardButton</a>)</h3><p>Returns the text on button <i>which</i>.</p>
<p>If a text has ben set using <a href="qwizard.html#setButtonText">setButtonText</a>(), this text is returned.</p>
<p>By default, the text on buttons depends on the <a href="qwizard.html#wizardStyle-prop">wizardStyle</a>. For example, on Mac OS X, the <b>Next</b> button is called <b>Continue</b>.</p>
<p>See also <a href="qwizard.html#button">button</a>(), <a href="qwizard.html#setButton">setButton</a>(), <a href="qwizard.html#setButtonText">setButtonText</a>(), <a href="qwizardpage.html#buttonText">QWizardPage.buttonText</a>(), and <a href="qwizardpage.html#setButtonText">QWizardPage.setButtonText</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/cleanupPage" />
<h3 class="fn"><a name="cleanupPage" />QWizard.cleanupPage (<i>self</i>, int)</h3><p>This virtual function is called by <a href="qwizard.html">QWizard</a> to clean up page <i>id</i> just before the user leaves it by clicking <b>Back</b> (unless the <a href="qwizard.html#WizardOption-enum">QWizard.IndependentPages</a> option is set).</p>
<p>The default implementation calls <a href="qwizardpage.html#cleanupPage">QWizardPage.cleanupPage</a>() on page(<i>id</i>).</p>
<p>See also <a href="qwizardpage.html#cleanupPage">QWizardPage.cleanupPage</a>() and <a href="qwizard.html#initializePage">initializePage</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/currentIdChanged" />
<h3 class="fn"><a name="currentId" />int QWizard.currentId (<i>self</i>)</h3><h3 class="fn"><a name="currentPage" /><a href="qwizardpage.html">QWizardPage</a> QWizard.currentPage (<i>self</i>)</h3><p>Returns a pointer to the current page, or 0 if there is no current page (e.g., before the wizard is shown).</p>
<p>This is equivalent to calling page(<a href="qwizard.html#currentId-prop">currentId</a>()).</p>
<p>See also <a href="qwizard.html#page">page</a>(), <a href="qwizard.html#currentId-prop">currentId</a>(), and <a href="qwizard.html#restart">restart</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/customButtonClicked" />
<h3 class="fn"><a name="done" />QWizard.done (<i>self</i>, int)</h3><p>Reimplemented from <a href="qdialog.html#done">QDialog.done</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/event" />
<h3 class="fn"><a name="event" />bool QWizard.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/field" />
<h3 class="fn"><a name="field" />QVariant QWizard.field (<i>self</i>, QString)</h3><p>Returns the value of the field called <i>name</i>.</p>
<p>This function can be used to access fields on any page of the wizard.</p>
<p>See also <a href="qwizardpage.html#registerField">QWizardPage.registerField</a>(), <a href="qwizardpage.html#field">QWizardPage.field</a>(), and <a href="qwizard.html#setField">setField</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/hasVisitedPage" />
<h3 class="fn"><a name="hasVisitedPage" />bool QWizard.hasVisitedPage (<i>self</i>, int)</h3><p>Returns true if the page history contains page <i>id</i>; otherwise, returns false.</p>
<p>Pressing <b>Back</b> marks the current page as "unvisited" again.</p>
<p>See also <a href="qwizard.html#visitedPages">visitedPages</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/helpRequested" />
<h3 class="fn"><a name="initializePage" />QWizard.initializePage (<i>self</i>, int)</h3><p>This virtual function is called by <a href="qwizard.html">QWizard</a> to prepare page <i>id</i> just before it is shown either as a result of <a href="qwizard.html#restart">QWizard.restart</a>() being called, or as a result of the user clicking <b>Next</b>. (However, if the <a href="qwizard.html#WizardOption-enum">QWizard.IndependentPages</a> option is set, this function is only called the first time the page is shown.)</p>
<p>By reimplementing this function, you can ensure that the page's fields are properly initialized based on fields from previous pages.</p>
<p>The default implementation calls <a href="qwizardpage.html#initializePage">QWizardPage.initializePage</a>() on page(<i>id</i>).</p>
<p>See also <a href="qwizardpage.html#initializePage">QWizardPage.initializePage</a>() and <a href="qwizard.html#cleanupPage">cleanupPage</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/next" />
<h3 class="fn"><a name="next" />QWizard.next (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void next()</tt>.</p><p>Advances to the next page.</p>
<p>This is equivalent to pressing the <b>Next</b> or <b>Commit</b> button.</p>
<p>See also <a href="qwizard.html#nextId">nextId</a>(), <a href="qwizard.html#back">back</a>(), <a href="qdialog.html#accept">accept</a>(), <a href="qdialog.html#reject">reject</a>(), and <a href="qwizard.html#restart">restart</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/nextId" />
<h3 class="fn"><a name="nextId" />int QWizard.nextId (<i>self</i>)</h3><p>This virtual function is called by <a href="qwizard.html">QWizard</a> to find out which page to show when the user clicks the <b>Next</b> button.</p>
<p>The return value is the ID of the next page, or -1 if no page follows.</p>
<p>The default implementation calls <a href="qwizardpage.html#nextId">QWizardPage.nextId</a>() on the <a href="qwizard.html#currentPage">currentPage</a>().</p>
<p>By reimplementing this function, you can specify a dynamic page order.</p>
<p>See also <a href="qwizardpage.html#nextId">QWizardPage.nextId</a>() and <a href="qwizard.html#currentPage">currentPage</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/page" />
<h3 class="fn"><a name="options" /><a href="qwizard-wizardoptions.html">WizardOptions</a> QWizard.options (<i>self</i>)</h3><h3 class="fn"><a name="page" /><a href="qwizardpage.html">QWizardPage</a> QWizard.page (<i>self</i>, int)</h3><p>Returns the page with the given <i>id</i>, or 0 if there is no such page.</p>
<p>See also <a href="qwizard.html#addPage">addPage</a>() and <a href="qwizard.html#setPage">setPage</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/pageIds" />
<h3 class="fn"><a name="pageIds" />list-of-int QWizard.pageIds (<i>self</i>)</h3><p>Returns the list of page IDs.</p>
<p>This function was introduced in Qt 4.5.</p>
<a name="//apple_ref/cpp/instm/QWizard/paintEvent" />
<h3 class="fn"><a name="paintEvent" />QWizard.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/pixmap" />
<h3 class="fn"><a name="pixmap" /><a href="qpixmap.html">QPixmap</a> QWizard.pixmap (<i>self</i>, <a href="qwizard.html#WizardPixmap-enum">WizardPixmap</a>)</h3><p>Returns the pixmap set for role <i>which</i>.</p>
<p>By default, the only pixmap that is set is the <a href="qwizard.html#WizardPixmap-enum">BackgroundPixmap</a> on Mac OS X.</p>
<p>See also <a href="qwizard.html#setPixmap">setPixmap</a>(), <a href="qwizardpage.html#pixmap">QWizardPage.pixmap</a>(), and <a href="qwizard.html#elements-of-a-wizard-page">Elements of a Wizard Page</a>.</p>
<a name="//apple_ref/cpp/instm/QWizard/removePage" />
<h3 class="fn"><a name="removePage" />QWizard.removePage (<i>self</i>, int)</h3><p>Removes the page with the given <i>id</i>. <a href="qwizard.html#cleanupPage">cleanupPage</a>() will be called if necessary.</p>
<p>This function was introduced in Qt 4.5.</p>
<p>See also <a href="qwizard.html#addPage">addPage</a>() and <a href="qwizard.html#setPage">setPage</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/resizeEvent" />
<h3 class="fn"><a name="resizeEvent" />QWizard.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget.resizeEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/restart" />
<h3 class="fn"><a name="restart" />QWizard.restart (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void restart()</tt>.</p><p>Restarts the wizard at the start page. This function is called automatically when the wizard is shown.</p>
<p>See also <a href="qwizard.html#startId-prop">startId</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/setButton" />
<h3 class="fn"><a name="setButton" />QWizard.setButton (<i>self</i>, <a href="qwizard.html#WizardButton-enum">WizardButton</a>, <a href="qabstractbutton.html">QAbstractButton</a>)</h3><p>The <i>QAbstractButton</i> argument has it's ownership transferred to Qt.</p><p>Sets the button corresponding to role <i>which</i> to <i>button</i>.</p>
<p>To add extra buttons to the wizard (e.g., a <b>Print</b> button), one way is to call setButton() with <a href="qwizard.html#WizardButton-enum">CustomButton1</a> to <a href="qwizard.html#WizardButton-enum">CustomButton3</a>, and make the buttons visible using the <a href="qwizard.html#WizardOption-enum">HaveCustomButton1</a> to <a href="qwizard.html#WizardOption-enum">HaveCustomButton3</a> options.</p>
<p>See also <a href="qwizard.html#button">button</a>(), <a href="qwizard.html#setButtonText">setButtonText</a>(), <a href="qwizard.html#setButtonLayout">setButtonLayout</a>(), and <a href="qwizard.html#options-prop">options</a>.</p>
<a name="//apple_ref/cpp/instm/QWizard/setButtonLayout" />
<h3 class="fn"><a name="setButtonLayout" />QWizard.setButtonLayout (<i>self</i>, list-of-QWizard.WizardButton)</h3><p>Sets the order in which buttons are displayed to <i>layout</i>, where <i>layout</i> is a list of <a href="qwizard.html#WizardButton-enum">WizardButton</a>s.</p>
<p>The default layout depends on the options (e.g., whether <a href="qwizard.html#WizardOption-enum">HelpButtonOnRight</a>) that are set. You can call this function if you need more control over the buttons' layout than what <a href="qwizard.html#options-prop">options</a> already provides.</p>
<p>You can specify horizontal stretches in the layout using <a href="qwizard.html#WizardButton-enum">Stretch</a>.</p>
<p>Example:</p>
<pre> MyWizard.MyWizard(QWidget *parent)
: QWizard(parent)
{
...
QList<QWizard.WizardButton> layout;
layout << QWizard.Stretch << QWizard.BackButton << QWizard.CancelButton
<< QWizard.NextButton << QWizard.FinishButton;
setButtonLayout(layout);
...
}</pre>
<p>See also <a href="qwizard.html#setButton">setButton</a>(), <a href="qwizard.html#setButtonText">setButtonText</a>(), and <a href="qwizard.html#options-prop">setOptions</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/setButtonText" />
<h3 class="fn"><a name="setButtonText" />QWizard.setButtonText (<i>self</i>, <a href="qwizard.html#WizardButton-enum">WizardButton</a>, QString)</h3><p>Sets the text on button <i>which</i> to be <i>text</i>.</p>
<p>By default, the text on buttons depends on the <a href="qwizard.html#wizardStyle-prop">wizardStyle</a>. For example, on Mac OS X, the <b>Next</b> button is called <b>Continue</b>.</p>
<p>To add extra buttons to the wizard (e.g., a <b>Print</b> button), one way is to call setButtonText() with <a href="qwizard.html#WizardButton-enum">CustomButton1</a>, <a href="qwizard.html#WizardButton-enum">CustomButton2</a>, or <a href="qwizard.html#WizardButton-enum">CustomButton3</a> to set their text, and make the buttons visible using the <a href="qwizard.html#WizardOption-enum">HaveCustomButton1</a>, <a href="qwizard.html#WizardOption-enum">HaveCustomButton2</a>, and/or <a href="qwizard.html#WizardOption-enum">HaveCustomButton3</a> options.</p>
<p>Button texts may also be set on a per-page basis using <a href="qwizardpage.html#setButtonText">QWizardPage.setButtonText</a>().</p>
<p>See also <a href="qwizard.html#buttonText">buttonText</a>(), <a href="qwizard.html#setButton">setButton</a>(), <a href="qwizard.html#button">button</a>(), <a href="qwizard.html#setButtonLayout">setButtonLayout</a>(), <a href="qwizard.html#options-prop">setOptions</a>(), and <a href="qwizardpage.html#setButtonText">QWizardPage.setButtonText</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/setDefaultProperty" />
<h3 class="fn"><a name="setDefaultProperty" />QWizard.setDefaultProperty (<i>self</i>, str, str, str)</h3><p>Sets the default property for <i>className</i> to be <i>property</i>, and the associated change signal to be <i>changedSignal</i>.</p>
<p>The default property is used when an instance of <i>className</i> (or of one of its subclasses) is passed to <a href="qwizardpage.html#registerField">QWizardPage.registerField</a>() and no property is specified.</p>
<p><a href="qwizard.html">QWizard</a> knows the most common Qt widgets. For these (or their subclasses), you don't need to specify a <i>property</i> or a <i>changedSignal</i>. The table below lists these widgets:</p>
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic">
<thead><tr class="qt-style" valign="top"><th>Widget</th><th>Property</th><th>Change Notification Signal</th></tr></thead>
<tr class="odd" valign="top"><td><a href="qabstractbutton.html">QAbstractButton</a></td><td>bool <a href="qabstractbutton.html#checked-prop">checked</a></td><td><a href="qabstractbutton.html#toggled">toggled()</a></td></tr>
<tr class="even" valign="top"><td><a href="qabstractslider.html">QAbstractSlider</a></td><td>int <a href="qabstractslider.html#value-prop">value</a></td><td><a href="qabstractslider.html#valueChanged">valueChanged()</a></td></tr>
<tr class="odd" valign="top"><td><a href="qcombobox.html">QComboBox</a></td><td>int <a href="qcombobox.html#currentIndex-prop">currentIndex</a></td><td><a href="qcombobox.html#currentIndexChanged">currentIndexChanged()</a></td></tr>
<tr class="even" valign="top"><td><a href="qdatetimeedit.html">QDateTimeEdit</a></td><td><a href="qdatetime.html">QDateTime</a> <a href="qdatetimeedit.html#dateTime-prop">dateTime</a></td><td><a href="qdatetimeedit.html#dateTimeChanged">dateTimeChanged()</a></td></tr>
<tr class="odd" valign="top"><td><a href="qlineedit.html">QLineEdit</a></td><td><a href="qstring.html">QString</a> <a href="qlineedit.html#text-prop">text</a></td><td><a href="qlineedit.html#textChanged">textChanged()</a></td></tr>
<tr class="even" valign="top"><td><a href="qlistwidget.html">QListWidget</a></td><td>int <a href="qlistwidget.html#currentRow-prop">currentRow</a></td><td><a href="qlistwidget.html#currentRowChanged">currentRowChanged()</a></td></tr>
<tr class="odd" valign="top"><td><a href="qspinbox.html">QSpinBox</a></td><td>int <a href="qspinbox.html#value-prop">value</a></td><td><a href="qspinbox.html#valueChanged">valueChanged()</a></td></tr>
</table></p>
<p>See also <a href="qwizardpage.html#registerField">QWizardPage.registerField</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/setField" />
<h3 class="fn"><a name="setField" />QWizard.setField (<i>self</i>, QString, QVariant)</h3><p>Sets the value of the field called <i>name</i> to <i>value</i>.</p>
<p>This function can be used to set fields on any page of the wizard.</p>
<p>See also <a href="qwizardpage.html#registerField">QWizardPage.registerField</a>(), <a href="qwizardpage.html#setField">QWizardPage.setField</a>(), and <a href="qwizard.html#field">field</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/setOption" />
<h3 class="fn"><a name="setOption" />QWizard.setOption (<i>self</i>, <a href="qwizard.html#WizardOption-enum">WizardOption</a>, bool <i>on</i> = True)</h3><p>Sets the given <i>option</i> to be enabled if <i>on</i> is true; otherwise, clears the given <i>option</i>.</p>
<p>See also <a href="qwizard.html#options-prop">options</a>, <a href="qwizard.html#testOption">testOption</a>(), and <a href="qwizard.html#wizardStyle-prop">setWizardStyle</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/setPage" />
<h3 class="fn"><a name="setOptions" />QWizard.setOptions (<i>self</i>, <a href="qwizard-wizardoptions.html">WizardOptions</a>)</h3><h3 class="fn"><a name="setPage" />QWizard.setPage (<i>self</i>, int, <a href="qwizardpage.html">QWizardPage</a>)</h3><p>The <i>QWizardPage</i> argument has it's ownership transferred to Qt.</p><p>Adds the given <i>page</i> to the wizard with the given <i>id</i>.</p>
<p>See also <a href="qwizard.html#addPage">addPage</a>() and <a href="qwizard.html#page">page</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/setPixmap" />
<h3 class="fn"><a name="setPixmap" />QWizard.setPixmap (<i>self</i>, <a href="qwizard.html#WizardPixmap-enum">WizardPixmap</a>, <a href="qpixmap.html">QPixmap</a>)</h3><p>Sets the pixmap for role <i>which</i> to <i>pixmap</i>.</p>
<p>The pixmaps are used by <a href="qwizard.html">QWizard</a> when displaying a page. Which pixmaps are actually used depend on the <a href="qwizard.html#wizard-look-and-feel">wizard style</a>.</p>
<p>Pixmaps can also be set for a specific page using <a href="qwizardpage.html#setPixmap">QWizardPage.setPixmap</a>().</p>
<p>See also <a href="qwizard.html#pixmap">pixmap</a>(), <a href="qwizardpage.html#setPixmap">QWizardPage.setPixmap</a>(), and <a href="qwizard.html#elements-of-a-wizard-page">Elements of a Wizard Page</a>.</p>
<a name="//apple_ref/cpp/instm/QWizard/setVisible" />
<h3 class="fn"><a name="setStartId" />QWizard.setStartId (<i>self</i>, int)</h3><h3 class="fn"><a name="setSubTitleFormat" />QWizard.setSubTitleFormat (<i>self</i>, <a href="qt.html#TextFormat-enum">Qt.TextFormat</a>)</h3><h3 class="fn"><a name="setTitleFormat" />QWizard.setTitleFormat (<i>self</i>, <a href="qt.html#TextFormat-enum">Qt.TextFormat</a>)</h3><h3 class="fn"><a name="setVisible" />QWizard.setVisible (<i>self</i>, bool)</h3><p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget.setVisible</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/sizeHint" />
<h3 class="fn"><a name="setWizardStyle" />QWizard.setWizardStyle (<i>self</i>, <a href="qwizard.html#WizardStyle-enum">WizardStyle</a>)</h3><h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QWizard.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/testOption" />
<h3 class="fn"><a name="startId" />int QWizard.startId (<i>self</i>)</h3><h3 class="fn"><a name="subTitleFormat" /><a href="qt.html#TextFormat-enum">Qt.TextFormat</a> QWizard.subTitleFormat (<i>self</i>)</h3><h3 class="fn"><a name="testOption" />bool QWizard.testOption (<i>self</i>, <a href="qwizard.html#WizardOption-enum">WizardOption</a>)</h3><p>Returns true if the given <i>option</i> is enabled; otherwise, returns false.</p>
<p>See also <a href="qwizard.html#options-prop">options</a>, <a href="qwizard.html#setOption">setOption</a>(), and <a href="qwizard.html#wizardStyle-prop">setWizardStyle</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/validateCurrentPage" />
<h3 class="fn"><a name="titleFormat" /><a href="qt.html#TextFormat-enum">Qt.TextFormat</a> QWizard.titleFormat (<i>self</i>)</h3><h3 class="fn"><a name="validateCurrentPage" />bool QWizard.validateCurrentPage (<i>self</i>)</h3><p>This virtual function is called by <a href="qwizard.html">QWizard</a> when the user clicks <b>Next</b> or <b>Finish</b> 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.</p>
<p>The default implementation calls <a href="qwizardpage.html#validatePage">QWizardPage.validatePage</a>() on the <a href="qwizard.html#currentPage">currentPage</a>().</p>
<p>When possible, it is usually better style to disable the <b>Next</b> or <b>Finish</b> button (by specifying <a href="qwizard.html#mandatory-fields">mandatory fields</a> or by reimplementing <a href="qwizardpage.html#isComplete">QWizardPage.isComplete</a>()) than to reimplement validateCurrentPage().</p>
<p>See also <a href="qwizardpage.html#validatePage">QWizardPage.validatePage</a>() and <a href="qwizard.html#currentPage">currentPage</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/visitedPages" />
<h3 class="fn"><a name="visitedPages" />list-of-int QWizard.visitedPages (<i>self</i>)</h3><p>Returns the list of IDs of visited pages, in the order in which the pages were visited.</p>
<p>Pressing <b>Back</b> marks the current page as "unvisited" again.</p>
<p>See also <a href="qwizard.html#hasVisitedPage">hasVisitedPage</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/winEvent" />
<h3 class="fn"><a name="wizardStyle" /><a href="qwizard.html#WizardStyle-enum">WizardStyle</a> QWizard.wizardStyle (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="currentIdChanged" />void currentIdChanged (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the current page changes, with the new current <i>id</i>.</p>
<p>See also <a href="qwizard.html#currentId-prop">currentId</a>() and <a href="qwizard.html#currentPage">currentPage</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/currentPage" />
<h3 class="fn"><a name="customButtonClicked" />void customButtonClicked (int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the user clicks a custom button. <i>which</i> can be <a href="qwizard.html#WizardButton-enum">CustomButton1</a>, <a href="qwizard.html#WizardButton-enum">CustomButton2</a>, or <a href="qwizard.html#WizardButton-enum">CustomButton3</a>.</p>
<p>By default, no custom button is shown. Call <a href="qwizard.html#setOption">setOption</a>() with <a href="qwizard.html#WizardOption-enum">HaveCustomButton1</a>, <a href="qwizard.html#WizardOption-enum">HaveCustomButton2</a>, or <a href="qwizard.html#WizardOption-enum">HaveCustomButton3</a> to have one, and use <a href="qwizard.html#setButtonText">setButtonText</a>() or <a href="qwizard.html#setButton">setButton</a>() to configure it.</p>
<p>See also <a href="qwizard.html#helpRequested">helpRequested</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/done" />
<h3 class="fn"><a name="helpRequested" />void helpRequested ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the user clicks the <b>Help</b> button.</p>
<p>By default, no <b>Help</b> button is shown. Call setOption(<a href="qwizard.html#WizardOption-enum">HaveHelpButton</a>, true) to have one.</p>
<p>Example:</p>
<pre> LicenseWizard.LicenseWizard(QWidget *parent)
: QWizard(parent)
{
...
setOption(HaveHelpButton, true);
connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));
...
}
void LicenseWizard.showHelp()
{
static QString lastHelpMessage;
QString message;
switch (currentId()) {
case Page_Intro:
message = tr("The decision you make here will affect which page you "
"get to see next.");
break;
...
default:
message = tr("This help is likely not to be of any help.");
}
QMessageBox.information(this, tr("License Wizard Help"), message);
}</pre>
<p>See also <a href="qwizard.html#customButtonClicked">customButtonClicked</a>().</p>
<a name="//apple_ref/cpp/instm/QWizard/initializePage" />
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.2</td></tr></table></div></address></body></html>
|