Nesta página

QFont::Tag Struct

struct QFont::Tag

O tipo ` QFont::Tag ` oferece acesso a recursos avançados de fontes. Mais...

Essa estrutura foi introduzida no Qt 6.7.

Funções públicas

Tag()
Tag(const char (&str)[N])
bool isValid() const
QByteArray toString() const
quint32 value() const

Membros públicos estáticos

std::optional<QFont::Tag> fromString(QAnyStringView view)
std::optional<QFont::Tag> fromValue(quint32 value)
Qt::strong_ordering compareThreeWay(const QFont::Tag &lhs, const QFont::Tag &rhs)
bool comparesEqual(const QFont::Tag &lhs, const QFont::Tag &rhs)
size_t qHash(QFont::Tag key, size_t seed = 0)
QDataStream &operator<<(QDataStream &, QFont::Tag)
QDataStream &operator>>(QDataStream &, QFont::Tag &)

Descrição detalhada

QFont fornece acesso a recursos avançados ao formatar texto. Um recurso é definido por uma tag, que pode ser representada como uma string de quatro caracteres ou como um valor inteiro de 32 bits. Este tipo representa tal tag de maneira segura em termos de tipo. Ele pode ser construído a partir de um literal de string de quatro caracteres (8 bits) ou de um valor inteiro de 32 bits correspondente. O uso de um literal de string mais curto ou mais longo resultará em um erro de compilação.

QFont font;
// Correct
font.setFeature("frac");

// Wrong - won't compile
font.setFeature("fraction");

// Wrong - will produce runtime warning and fail
font.setFeature(u"fraction"_s);

Os construtores nomeados permitem criar uma tag a partir de um valor inteiro de 32 bits ou de uma string e retornarão um ` std::nullopt ` quando a entrada for inválida.

Veja também ` QFont::setFeature()` e ` QFont::featureTags()`.

Documentação das funções-membro

[constexpr noexcept default] Tag::Tag()

Construtor padrão, que gera uma tag inválida.

[constexpr noexcept] template <size_t N> Tag::Tag(const char (&str)[N])

Cria uma tag a partir de um literal de string, str. O literal deve ter exatamente quatro caracteres.

font.setFeature("frac", 1);

Veja também fromString() e fromValue().

[static noexcept] std::optional<QFont::Tag> Tag::fromString(QAnyStringView view)

Retorna uma tag criada a partir da string em view. A string deve ter exatamente quatro caracteres.

Retorna ` std::nullopt ` se a entrada não tiver quatro caracteres ou se a tag gerada for inválida.

Veja também isValid() e fromValue().

[static constexpr noexcept] std::optional<QFont::Tag> Tag::fromValue(quint32 value)

Retorna uma tag criada a partir de value ou std::nullopt, caso a tag gerada seja inválida.

Veja também isValid().

[constexpr noexcept] bool Tag::isValid() const

Retorna se a tag é válida. Uma tag é válida se seu valor não for zero.

Veja também value(), fromValue() e fromString().

QByteArray Tag::toString() const

Retorna a representação em string desta tag como uma matriz de bytes.

Veja também ` fromString()`.

[constexpr noexcept] quint32 Tag::value() const

Retorna o valor numérico desta tag.

Veja também isValid() e fromValue().

Não-membros relacionados

[constexpr noexcept] Qt::strong_ordering compareThreeWay(const QFont::Tag &lhs, const QFont::Tag &rhs)

[constexpr noexcept] bool comparesEqual(const QFont::Tag &lhs, const QFont::Tag &rhs)

Compare lhs com rhs para verificar a igualdade e a ordem.

[constexpr noexcept] size_t qHash(QFont::Tag key, size_t seed = 0)

Retorna o valor hash de key, utilizando seed como semente para o cálculo.

Operadores de fluxo de dados para QFont::Tag.

© 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.