En esta página

Qt::Literals Namespace

namespace Qt::Literals

El espacio de nombres Literals declara operadores literales para tipos Qt. Más...

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

Espacios de nombres

namespace StringLiterals

Descripción detallada

Espacios de nombres

namespace Literals::StringLiterals

El espacio de nombres inline Qt::Literals::StringLiterals declara operadores literales para tipos de cadena Qt. Dado que ambos espacios de nombres Literals y StringLiterals están declarados como inline, se puede acceder a los símbolos de este espacio de nombres añadiendo uno de los siguientes a tu código:

// 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;

Esto último se desaconseja, porque no permite elegir qué operadores literales se desean en caso de que Qt añada operadores conflictivos en diferentes espacios de nombres dentro de Qt::Literals.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.