aboutsummaryrefslogtreecommitdiffstats
path: root/doc/qtcreator/src/howto/creator-external-tools.qdoc
blob: dda7eeb62ae8d2d3c45ae047f0debcd1a9226b22 (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
235
236
237
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************

/*!
    \page creator-editor-external.html
    \if defined(qtdesignstudio)
    \previouspage quick-converting-ui-projects.html
    \nextpage studio-on-mcus.html
    \else
    \previouspage creator-how-tos.html
    \endif

    \ingroup creator-how-to-use

    \title Use external tools

    You can use external tools directly from \QC. Qt Linguist, QML preview
    tools, and the default text editor for your system are preconfigured
    for use. You can change their default configurations and configure new
    tools.

    To run the tools, select \uicontrol Tools > \uicontrol External, or use the
    \c x filter in the locator.

    \section1 Configure external tools

    You can change the configuration of preconfigured tools and configure
    additional tools in \QC \preferences.

    \image qtcreator-external-tools.png

    \if defined(qtcreator)
    Select the \inlineimage icons/replace.png
    (\uicontrol {Variables}) button in a field to select from a list of
    \l{Use Qt Creator variables}{variables} that are available in a
    particular context.
    \endif

    To configure external tools:

    \list 1

        \li Select \uicontrol Tools > \uicontrol External >
            \uicontrol Configure.

        \li Select \uicontrol Add > \uicontrol {Add Tool}
            to add a new tool. You can also select \uicontrol {Add Category} to add a
            new category.

        \li In the \uicontrol Executable field, specify the executable to run. If the
            executable is found in your system PATH variable, do not specify
            the path to it.

        \li In the \uicontrol Arguments field, specify optional arguments for running
            the executable.

        \li In the \uicontrol {Working directory} field, specify the path to the
            working directory.

        \li In the \uicontrol Output field, select how to handle output from the
            tool. You can ignore the output, view it in \l{View output}
            {General Messages}, or replace the selected text with the
            output in the code editor.

        \li In the \uicontrol {Error output} field, select how to handle error
            messages from the tool.

        \if defined(qtcreator)
        \li In the \uicontrol {Base environment} field, select whether to run
            the tool in the system environment or the \l{Specify the environment for projects}
            {build environment} or \l {Specify the run environment}
            {run environment} of the active project. Select the build or run
            environment if the system environment does not have the necessary
            PATH settings to find the tool chain, for example.
        \else
        \li In the \uicontrol {Base environment} field, use the default settings.
        \endif

        \li In the \uicontrol Environment field, select \uicontrol Change to modify
            environment variable values for build and run environments in
            the \uicontrol {Edit Environment} dialog.

            To globally change the system environment from the one in which
            \QC is started, select \preferences >
            \uicontrol Environment > \uicontrol System, and then select
            \uicontrol Change in the \uicontrol Environment field.

        \li Select the \uicontrol {Modifies current document} check box to make sure
            that if the current document is modified by the tool, it is saved
            before the tool is run and reloaded after the tool finishes.

        \li In the \uicontrol Input field, specify text that is passed as standard
            input to the tool.

    \endlist

    The category and tool are added to the \uicontrol Tools >
    \uicontrol External menu.

    If you change the configuration of preconfigured tools, you can later
    revert the changes by selecting the \uicontrol Reset button.

    The tool configurations that you add and modify are stored in XML format in
    the user configuration folder. For example,
    \c {~/config/QtProject/qtcreator/externaltools}
    on Linux and \macos and
    \c {C:\Users\username\AppData\Roaming\QtProject\qtcreator\externaltools}
    in Windows. To share a configuration with other users, copy an XML
    configuration file to the folder.

    \sa {Run QML files}, {Use external text editors}, {Use Qt Linguist}

    \if defined(qtcreator)
    \sa {Batch edit environment settings}, {Specify the environment for projects},
    {Use Qt Creator variables}
    \endif
*/

/*!
    \page creator-how-to-use-qtlinguist.html
    \if defined(qtdesignstudio)
    \previouspage creator-editor-external.html
    \else
    \previouspage creator-how-tos.html
    \endif

    \ingroup creator-how-to-use

    \title Use Qt Linguist

    Most of the text to translate in an application consists of either single
    words or short phrases. These typically appear as window titles, menu items,
    tooltips, and labels to buttons, checkboxes, and radio buttons.

    You mark the phrases as translatable in the QML and C++ source code. Qt
    localization tools provide context information for each of the phrases to
    help the translator understand their meaning. You can add comments to the
    phrases.

    Translation files contain all the user-visible text and keyboard shortcuts
    in an application and translations of that text.

    When you \l{Creating Projects}{create a new project}, you can automatically
    generate a translation source file (TS) for one language. To add other
    languages, edit the project file or go to \uicontrol File >
    \uicontrol {New File}.

    To open TS files in Qt Linguist, right-click a TS file in the
    \uicontrol Projects or \uicontrol {File System} view and go to
    \uicontrol {Open With} > \uicontrol {Qt Linguist} in the context menu.

    \section1 Use lupdate and lrelease

    Use the Qt Linguist release manager tools, lupdate and lrelease,
    directly from \QC. The lupdate tool synchronizes source
    code and translations. The lrelease tool creates run-time
    translation files for use by the released application.

    \note Running the tools from \QC is supported only when using qmake as the
    build system. For more information about using the tools with CMake, see
    \l{https://doc.qt.io/qt-6/cmake-command-reference.html#qt6-linguisttools}
    {Qt6::LinguistTools}.

    By default, the project .pro file is passed to the tools as an argument. To
    specify other command-line arguments for the tools, go to \uicontrol Tools >
    \uicontrol External > \uicontrol Configure.

    \section2 Synchronize TS files

    To synchronize TS files from a translator with the
    application code, go to \uicontrol Tools > \uicontrol External >
    \uicontrol Linguist > \uicontrol {Update Translations (lupdate)}.

    \section2 Generate QM files

    To generate from the TS files Qt message (QM) files that can be used by an
    application, go to \uicontrol Tools > \uicontrol External >
    \uicontrol Linguist > \uicontrol {Release Translations (lrelease)}.

    \if defined(qtcreator)
    \sa {Add translation files}
    \endif

    \sa {Use external tools}, {Internationalization with Qt},
    {Qt Linguist Manual}
*/

/*!
    \page creator-how-to-run-qml-files.html
    \if defined(qtdesignstudio)
    \previouspage creator-editor-external.html
    \else
    \previouspage creator-how-tos.html
    \endif

    \ingroup creator-how-to-design

    \title Run QML files

    You can test the current QML document while you are developing an application.

    To run the currently active QML file, select \uicontrol Tools >
    \uicontrol External > \uicontrol {Qt Quick} > \uicontrol {QML Runtime}.

    \sa {Use external tools}
*/

/*!
    \page creator-how-to-use-external-text-editors.html
    \if defined(qtdesignstudio)
    \previouspage creator-editor-external.html
    \else
    \previouspage creator-how-tos.html
    \endif

    \ingroup creator-how-to-use

    \title Use external text editors

    You can open files for editing in the default text editor for your system:
    Notepad on Windows and vi on Linux and \macos.
    To open the file you are currently viewing in an external editor, select
    \uicontrol Tools > \uicontrol External > \uicontrol Text >
    \uicontrol {Edit with Notepad} or \uicontrol {Edit with vi}, depending on
    your system.

    \QC looks for the editor path in the PATH environment variable
    of your operating system.

    \sa {Use external tools}
*/