| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the documentation of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | /*!
|
|---|
| 43 | \example dialogs/classwizard
|
|---|
| 44 | \title Class Wizard Example
|
|---|
| 45 |
|
|---|
| 46 | The License Wizard example shows how to implement linear
|
|---|
| 47 | wizards using QWizard.
|
|---|
| 48 |
|
|---|
| 49 | \image classwizard.png Screenshot of the Class Wizard example
|
|---|
| 50 |
|
|---|
| 51 | Most wizards have a linear structure, with page 1 followed by
|
|---|
| 52 | page 2 and so on until the last page. Some wizards are more
|
|---|
| 53 | complex in that they allow different traversal paths based on the
|
|---|
| 54 | information provided by the user. The
|
|---|
| 55 | \l{dialogs/licensewizard}{License Wizard} example shows how to
|
|---|
| 56 | create such wizards.
|
|---|
| 57 |
|
|---|
| 58 | The Class Wizard example consists of the following classes:
|
|---|
| 59 |
|
|---|
| 60 | \list
|
|---|
| 61 | \o \c ClassWizard inherits QWizard and provides a
|
|---|
| 62 | three-step wizard that generates the skeleton of a C++ class
|
|---|
| 63 | based on the user's input.
|
|---|
| 64 | \o \c IntroPage, \c ClassInfoPage, \c CodeStylePage, \c
|
|---|
| 65 | OutputFilesPage, and \c ConclusionPage are QWizardPage
|
|---|
| 66 | subclasses that implement the wizard pages.
|
|---|
| 67 | \endlist
|
|---|
| 68 |
|
|---|
| 69 | \section1 ClassWizard Class Definition
|
|---|
| 70 |
|
|---|
| 71 | \image classwizard-flow.png The Class Wizard pages
|
|---|
| 72 |
|
|---|
| 73 | We will see how to subclass QWizard to implement our own wizard.
|
|---|
| 74 | The concrete wizard class is called \c ClassWizard and provides
|
|---|
| 75 | five pages:
|
|---|
| 76 |
|
|---|
| 77 | \list
|
|---|
| 78 | \o The first page is an introduction page, telling the user what
|
|---|
| 79 | the wizard is going to do.
|
|---|
| 80 | \o The second page asks for a class name and a base class, and
|
|---|
| 81 | allows the user to specify whether the class should have a \c
|
|---|
| 82 | Q_OBJECT macro and what constructors it should provide.
|
|---|
| 83 | \o The third page allows the user to set some options related to the code
|
|---|
| 84 | style, such as the macro used to protect the header file from
|
|---|
| 85 | multiple inclusion (e.g., \c MYDIALOG_H).
|
|---|
| 86 | \o The fourth page allows the user to specify the names of the
|
|---|
| 87 | output files.
|
|---|
|
|---|