aboutsummaryrefslogtreecommitdiffstats
path: root/doc/qtcreator/src/projects/creator-only/creator-files-creating.qdoc
blob: d03263d462563f16c2f68a02c8208d6818c0a011 (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
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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page creator-file-creating.html
    \previouspage creator-how-tos.html

    \ingroup creator-how-to-projects-files

    \title Create files

    Use wizard templates to add individual files to your \l{Creating Projects}
    {projects}.

    To add files to projects, select \uicontrol File > \uicontrol {New File}, and
    then select the type of the file.

    \image qtcreator-new-file.webp {New File wizard}

    \note You can also use the \c f locator filter to create a new
    file and open it in the editor. For more information, see
    \l {Creating Files and Directories from Locator}. However, you must
    manually add the created file to a project.

    \section1 Select file type

    The following table lists the types of wizard templates that you can use
    for creating files. The \uicontrol {New File} dialog shows detailed information about each file
    wizard template.

    \table
    \header
        \li Category
        \li Purpose
    \row
        \li \uicontrol {C/C++}
        \li Header and source files for new classes.
    \row
        \li \uicontrol {Modeling}
        \li State Chart XML (SCXML) files, Universal Modeling Language (UML)
            style models, and scratch models that use a temporary file.
    \row
        \li \uicontrol {Qt}
        \li Source and header files for item, table,
            or list models, \QD forms and a matching classes for Qt Widgets
            projects, Qt resource and translation files, as well as QML and
            JavaScript files for Qt Quick projects.
    \row
        \li \uicontrol {Compiler Explorer}
        \li Example setup for using Compiler Explorer to compile C++ or Python
            code.
    \row
        \li \uicontrol {GLSL}
        \li OpenGL fragment and vertex shaders.
    \row
        \li \uicontrol {General}
        \li Markdown files, empty files that you can save with any filename
            extension, and scratch buffers that use temporary files.
    \row
        \li \uicontrol {Java}
        \li Class files.
    \row
        \li \uicontrol {Python}
        \li Class and script files for Python projects.
    \row
        \li \uicontrol {vcpkg} (experimental)
        \li vcpkg package manager manifest files (vcpkg.json).
    \row
        \li \uicontrol {Test Case}
        \li Test framework specific file holding a new test case, to be
            added to projects already using a test framework.
    \row
        \li \uicontrol {Nim} (experimental)
        \li Empty Nim source and script files.
    \endtable

    \sa {Add Files}{How To: Add Files}, {Create UML-style models},
    {Use project wizards}
*/

/*!
    \page creator-how-to-create-cpp-classes.html
    \previouspage creator-how-tos.html

    \ingroup creator-how-to-projects-files

    \title Create C++ classes

    To create a C++ header and source file for a new class that you can add to a
    C++ project:

    \list 1
        \li Select \uicontrol File > \uicontrol {New File} >
            \uicontrol {C++ Class Wizard} > \uicontrol Choose.
        \li Specify the class name, base class, and header and source files for
            the class.
            \image qtcreator-cpp-class-wizard.png {Enter Class Name dialog}
    \endlist

    The wizard supports namespaces. To use a namespace, enter a qualified
    class name in the \uicontrol {Class name} field. For example:
    \c MyNamespace::MySubNamespace::MyClass. The wizard suggests
    existing namespaces and class names as you type.

    You can also create your own project and class wizards.

    \sa {Create files}, {Set C++ file naming preferences}, {Use project wizards},
    {Custom Wizards}
*/

/*!
    \page creator-how-to-set-cpp-file-naming.html
    \previouspage creator-how-tos.html

    \ingroup creator-how-to-projects-files

    \title Set C++ file naming preferences

    When you use the new file wizard to create a C++ header and source file for a
    new class in a C++ project, the names of the header and source file are based
    on the class name. To change the default suffix of a file for a project,
    select \uicontrol Projects > \uicontrol {Project Settings} >
    \uicontrol {C++ File Naming}.

    \image qtcreator-projects-settings-cpp-file-naming.webp {C++ File Naming settings for a project}

    In the \uicontrol {License template} field, enter
    \l{Using Variables in Wizards}{predefined wizard variables} to specify the
    path and filename of the license to use in the source and header files.

    To globally change the preferences, select \preferences > \uicontrol {C++} >
    \uicontrol {File Naming}.

    \sa {Create C++ classes}, {Use project wizards}
*/

/*!
    \page creator-how-to-create-resource-files.html
    \previouspage creator-how-tos.html

    \ingroup creator-how-to-projects-files

    \title Create resource files

    The \l{The Qt Resource System}{Qt Resource System} is a platform-independent
    mechanism for storing files in the application's executable.

    To create a resource file:

    \list 1
        \li Select \uicontrol File > \uicontrol {New File} > \uicontrol {Qt} >
            \uicontrol {Qt Resource File} > \uicontrol Choose.
            \image qtcreator-add-resource-wizard.png {New File dialog}
        \li Follow the instructions of the wizard to create a resource
            collection file (.qrc).
        \li Open the resource file in the resource editor.
            \image qtcreator-add-resource.png "Editing resource files"
        \li Select \uicontrol {Add Files} to locate and add individual files.
    \endlist

    \section1 Sort resource files

    To list the folders and files in ascending alphabetic order in the source
    tree, select \uicontrol {Sort Alphabetically} in the context menu.

    \section1 Set a path prefix

    By default, resources in the application are accessible under the same file
    name as they have in the source tree, with a \c{:/} prefix, or by a URL with
    a \c qrc scheme. To specify a path prefix for all files in the \c .qrc file,
    select \uicontrol {Add Prefix} and enter the prefix in the \uicontrol Prefix
    field.

    \section1 Set a locale

    Some resources need to change based on the user's locale, such as
    translation files or icons. You can specify a locale in the
    \uicontrol Language field.

    Use a lowercase, two-letter \l {https://www.iso.org/iso-639-language-codes.html}
    {ISO 639 language code}, such as \e de, \e en, or \e fr.

    \section1 Remove resource files

    Select \uicontrol Remove to remove the selected file from the resource
    collection.

    In the \uicontrol {Remove File} dialog, select the
    \uicontrol {Delete file permanently} check box to remove the file from
    the file system.

    \image qtcreator-remove-file.webp {Remove File dialog}

    To remove files that cannot be found in the file system,
    select \uicontrol {Remove Missing Files}.

    The above functions are also available in the context menu in the
    \l Projects view.

    \sa {Create files}, {Use project wizards}, {QLocale}
*/

/*!
    \page creator-how-to-create-opengl-shaders.html
    \previouspage creator-how-tos.html

    \ingroup creator-how-to-projects-files

    \title Create OpenGL fragment and vertex shaders

    Qt supports integration with OpenGL implementations on all platforms, so you
    can display hardware accelerated 3D graphics alongside a more conventional
    user interface. For more information, see \l{Qt GUI}.

    You can use the QOpenGLShader class to compile OpenGL shaders written in the
    OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language
    (GLSL/ES). QOpenGLShader and QOpenGLShaderProgram shelter you from the
    details of compiling and linking vertex and fragment shaders.

    To create OpenGL shaders:

    \list 1
        \li Select \uicontrol File > \uicontrol {New File} > \uicontrol {GLSL}.
            \image qtcreator-new-opengl-file.png {New OpenGL file wizard}
        \li Select the type of the shader to create, and then select
            \uicontrol Choose.
        \li Follow the instructions of the wizard to create the shader file.
        \li Open the shader file in the code editor, and write the shader code
            in GLSL or GLSL/ES. The code editor offers syntax highlighting and
            code completion for the files.
    \endlist

    \sa {Create files}, {Use project wizards}
*/