Qt::Literals Namespace | Qt Core | Qt 6.11.1
Description: The Literals inline namespace declares literal operators for Qt types.

- Qt 6.11
- Qt Core
- Qt::Literals Namespace
- Qt 6.11.1 Reference Documentation

# Qt::Literals Namespace

namespace Qt::Literals

The Literals inline namespace declares literal operators for Qt types. More...

Header: | `#include <QString>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Core)` `target_link_libraries(mytarget PRIVATE Qt6::Core)`
qmake: | `QT += core`

## Namespaces

namespace | StringLiterals

## Detailed Description

## Namespaces

### namespace Literals::StringLiterals

The inline Qt::Literals::StringLiterals namespace declares literal operators for Qt string types. Because both `Literals` and `StringLiterals` namespaces are declared as inline, the symbols from this namespace can be accessed by adding one of the following to your code:

     // Makes visible only the literal operators declared in StringLiterals
     using namespace Qt::StringLiterals;
     // same, but needlessly verbose:
     using namespace Qt::Literals::StringLiterals;

     // Makes visible literal operators declared in all inline namespaces
     // inside Literals
     using namespace Qt::Literals;

     // Makes visible all symbols (including all literal operators) declared
     // in the Qt namespace
     using namespace Qt;

The latter is discouraged, because it doesn't allow you to pick which literal operators you want in case Qt adds conflicting operators in different namespaces within Qt::Literals.