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
qtliterals.qdoc
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3// Qt-Security score:insignificant reason:docs
4
5/*!
6 \namespace QtLiterals
7 \inmodule QtCore
8
9 \brief The QtLiterals namespace declares literal operators for Qt types.
10*/
11
12/*!
13 \namespace Qt::Literals
14 \inmodule QtCore
15 \inheaderfile QString
16
17 \brief The Literals inline namespace declares literal operators for Qt types.
18*/
19
20/*!
21 \namespace Qt::Literals::StringLiterals
22 \inmodule QtCore
23 \inheaderfile QString
24
25 \brief The StringLiterals namespace declares literal operators for Qt
26 string types.
27
28 The inline Qt::Literals::StringLiterals namespace declares literal operators
29 for Qt string types. Because both \c Literals and \c StringLiterals
30 namespaces are declared as inline, the symbols from this namespace can be
31 accessed by adding one of the following to your code:
32
33 \code
34 // Makes visible only the literal operators declared in StringLiterals
35 using namespace Qt::StringLiterals;
36 // same, but needlessly verbose:
37 using namespace Qt::Literals::StringLiterals;
38
39 // Makes visible literal operators declared in all inline namespaces
40 // inside Literals
41 using namespace Qt::Literals;
42
43 // Makes visible all symbols (including all literal operators) declared
44 // in the Qt namespace
45 using namespace Qt;
46 \endcode
47
48 The latter is discouraged, because it doesn't allow you to pick which literal
49 operators you want in case Qt adds conflicting operators in different
50 namespaces within Qt::Literals.
51*/