In questa pagina

QFont::Tag Struct

struct QFont::Tag

Il tipo ` QFont::Tag ` consente di accedere a funzionalità avanzate relative ai font. Maggiori informazioni...

Questa struttura è stata introdotta in Qt 6.7.

Funzioni pubbliche

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

Membri pubblici statici

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 &)

Descrizione dettagliata

QFont fornisce l'accesso a funzionalità avanzate durante la formattazione del testo. Una funzionalità è definita da un tag, che può essere rappresentato come una stringa di quattro caratteri o come un valore intero a 32 bit. Questo tipo rappresenta tale tag in modo sicuro dal punto di vista del tipo. Può essere costruito a partire da un letterale stringa di quattro caratteri a 8 bit oppure da un corrispondente valore intero a 32 bit. L'uso di un letterale stringa più corto o più lungo comporterà un errore in fase di compilazione.

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

I costruttori denominati consentono di creare un tag a partire da un valore intero a 32 bit o da una stringa e restituiscono un std::nullopt quando l’input non è valido.

Vedi anche ` QFont::setFeature()` e ` QFont::featureTags()`.

Documentazione sulle funzioni membro

[constexpr noexcept default] Tag::Tag()

Costruttore predefinito che genera un tag non valido.

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

Crea un tag a partire da una stringa letterale, str. La stringa letterale deve essere lunga esattamente quattro caratteri.

font.setFeature("frac", 1);

Vedi anche fromString() e fromValue().

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

Restituisce un tag generato dalla stringa contenuta in view. La stringa deve essere composta esattamente da quattro caratteri.

Restituisce std::nullopt se l'input non è lungo quattro caratteri o se il tag generato risulterebbe non valido.

Vedi anche isValid() e fromValue().

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

Restituisce un tag generato a partire da value oppure std::nullopt se il tag generato risulterà non valido.

Vedi anche isValid().

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

Restituisce se il tag è valido. Un tag è valido se il suo valore non è zero.

Vedi anche value(), fromValue() e fromString().

QByteArray Tag::toString() const

Restituisce la rappresentazione stringa di questo tag sotto forma di array di byte.

Vedi anche fromString().

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

Restituisce il valore numerico di questo tag.

Vedi anche isValid() e fromValue().

Elementi non membri correlati

[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)

Confronta lhs con rhs per verificare l'uguaglianza e l'ordinamento.

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

Restituisce il valore hash per key, utilizzando seed come seme per il calcolo.

Operatori di flussi di dati per 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.