aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api/qtcreator-dev-wizards.qdoc
blob: ddb11119eae0dfb86573f15e81164c6fd13a4d6b (plain)
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
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/

/*!
    \page qtcreator-dev-wizards.html
    \title Creating Wizards in Code

    \section1 Introduction

    If the functionality provided by template-based
    \l{http://doc.qt.io/qtcreator/creator-project-wizards.html}{custom wizards}
    is not sufficient for your case, you can write wizards in code.

    A wizard in \QC is an instance of a class implementing
    the Core::IWizardFactory interface that has a creator function registered
    with IWizardFactory::registerFactoryCreator.

    Implementing wizards requires:
    \list
    \li Writing a factory class that derives from Core::IWizardFactory. This is
        a very generic interface that does not make any assumption about what
        the wizard does and what its UI looks like.

    \li Providing a set of parameters that determine how the wizard shows up
        in the list of wizards in the  \uicontrol {New File or Project} dialog.

        When deriving from Core::IWizardFactory, the constructor has to call
        the following setters provided by the base class:

        \list
        \li \c setId
        \li \c setWizardKind
        \li \c setIcon
        \li \c setDescription
        \li \c setDisplayName
        \li \c setCategory
        \li \c setDisplayCategory
        \li \c setDescriptionImage
        \li \c setRequiredFeatures
        \li \c setFlags
        \endlist

    \li Implementing the wizard UI

        Typically, this will be a class derived from Utils::Wizard.
        Utils::Wizard extends QWizard with the functionality to show a progress
        bar on the left.

    \li Implementing the wizard functionality

        It is recommended to use Core::GeneratedFile to represent files
        that need to be written to disk. They allow to delay writing the actual
        data to disk till the wizard is done.
    \endlist

    \section2 Relevant Classes

    \table
        \header
            \li Class
            \li Description

        \row
            \li Core::IWizardFactory
            \li \QC wizard interface, implementations of which are registered
                with ExtensionSystem::PluginManager.

        \row
            \li Core::GeneratedFile
            \li A file containing name, contents, and some attributes.

        \row
            \li Utils::FileWizardPage
            \li Introductory wizard page asking for file name and path.

        \row
            \li Utils::ProjectIntroPage
            \li Introductory wizard page asking for project name and path.
    \endtable

    \section2 Setters and Getters of IWizardFactory

    The setters and getters listed below determine how the wizard shows up
    in the list of wizards in the  \uicontrol {New File or Project} dialog.

    \table
        \header
            \li Type
            \li Parameter Name
            \li Description

        \row
            \li Core::IWizardFactory::WizardKind
            \li kind
            \li Enumeration value that indicates the type of the wizard
                (\c project or \c file).

        \row
            \li QIcon
            \li icon
            \li Icon to show.

        \row
            \li QString
            \li description
            \li Descriptive text.

        \row
            \li QString
            \li displayName
            \li Name to be shown in the list.

        \row
            \li QString
            \li id
            \li Unique identifier for the wizard. It also determines the order
                within a category.

        \row
            \li QString
            \li category
            \li Identifier of the category under which the wizard is to be
                listed. It also determines the order of the categories.

        \row
            \li QString
            \li displayCategory
        \li Description of the category.
    \endtable

    All wizards that have the same category set will be grouped together in the
    \uicontrol {New File or Project} dialog.

*/