Qt 5.10 Book Examples
chapter32
Wizard
main.cpp
Go to the documentation of this file.
1
// ======================================================================
2
// main.cpp
3
// ======================================================================
4
// This file is a part of the book
5
// "Qt 5.10 Professional programming with C++"
6
// http://qt-book.com
7
// ======================================================================
8
// Copyright (c) 2017 by Max Schlee
9
// ======================================================================
10
11
#include <QtWidgets>
12
13
// ----------------------------------------------------------------------
14
class
Wizard
:
public
QWizard {
15
private
:
16
QWizardPage* createPage(QWidget* pwgt, QString strTitle)
17
{
18
QWizardPage* ppage =
new
QWizardPage;
19
ppage->setTitle(strTitle);
20
21
QVBoxLayout* playout =
new
QVBoxLayout;
22
playout->addWidget(pwgt);
23
ppage->setLayout(playout);
24
25
return
ppage;
26
}
27
28
public
:
29
Wizard
(QWidget* pwgt = 0) : QWizard(pwgt)
30
{
31
addPage(createPage(
new
QLabel(
"<H1>Label 1</H1>"
),
"One"
));
32
addPage(createPage(
new
QLabel(
"<H1>Label 2</H1>"
),
"Two"
));
33
addPage(createPage(
new
QLabel(
"<H1>Label 3</H1>"
),
"Three"
));
34
}
35
};
36
37
// ----------------------------------------------------------------------
38
int
main
(
int
argc,
char
** argv)
39
{
40
QApplication app(argc, argv);
41
Wizard
wizardDialog;
42
43
wizardDialog.show();
44
45
return
app.exec();
46
}
47
48
main
int main(int argc, char **argv)
Definition:
main.cpp:15
Wizard
Definition:
main.cpp:14
Wizard::Wizard
Wizard(QWidget *pwgt=0)
Definition:
main.cpp:29
Generated by
1.8.14