Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtresource.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2022 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\headerfile <QtResource>
6
\inmodule QtCore
7
\ingroup funclists
8
\brief Macros for managing the Qt resource system.
9
*/
10
11
/*!
12
\macro void Q_INIT_RESOURCE(name)
13
\relates <QtResource>
14
15
Initializes the resources specified by the \c .qrc file with the
16
specified base \a name. Normally, when resources are built as part
17
of the application, the resources are loaded automatically at
18
startup. The Q_INIT_RESOURCE() macro is necessary on some platforms
19
for resources stored in a static library.
20
21
For example, if your application's resources are listed in a file
22
called \c myapp.qrc, you can ensure that the resources are
23
initialized at startup by adding this line to your \c main()
24
function:
25
26
\snippet code/src_corelib_io_qdir.cpp 13
27
28
If the file name contains characters that cannot be part of a valid C++ function name
29
(such as '-'), they have to be replaced by the underscore character ('_').
30
31
\note This macro cannot be used in a namespace. It should be called from
32
main(). If that is not possible, the following workaround can be used
33
to init the resource \c myapp from the function \c{MyNamespace::myFunction}:
34
35
\snippet code/src_corelib_io_qdir.cpp 14
36
37
\sa Q_CLEANUP_RESOURCE(), {The Qt Resource System}
38
*/
39
40
/*!
41
\since 4.1
42
\macro void Q_CLEANUP_RESOURCE(name)
43
\relates <QtResource>
44
45
Unloads the resources specified by the \c .qrc file with the base
46
name \a name.
47
48
Normally, Qt resources are unloaded automatically when the
49
application terminates, but if the resources are located in a
50
plugin that is being unloaded, call Q_CLEANUP_RESOURCE() to force
51
removal of your resources.
52
53
\note This macro cannot be used in a namespace. Please see the
54
Q_INIT_RESOURCE documentation for a workaround.
55
56
Example:
57
58
\snippet code/src_corelib_io_qdir.cpp 15
59
60
\sa Q_INIT_RESOURCE(), {The Qt Resource System}
61
*/
qtbase
src
corelib
global
qtresource.qdoc
Generated on
for Qt by
1.14.0