Tag Struct

struct QFont::Tag

Der Typ QFont::Tag ermöglicht den Zugriff auf erweiterte Schriftfunktionen. Mehr...

Diese Struktur wurde in Qt 6.7 eingeführt.

Öffentliche Funktionen

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

Statische öffentliche Mitglieder

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)

Detaillierte Beschreibung

QFont ermöglicht den Zugriff auf erweiterte Funktionen bei der Textformung. Ein Merkmal wird durch ein Tag definiert, das als vierstellige Zeichenkette oder als 32-Bit-Ganzzahlwert dargestellt werden kann. Dieser Typ repräsentiert ein solches Tag auf eine typsichere Weise. Er kann aus einem vierstelligen 8-Bit-Stringliteral oder aus einem entsprechenden 32-Bit-Integerwert konstruiert werden. Die Verwendung eines kürzeren oder längeren String-Literales führt zu einem Kompilierfehler.

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

Die benannten Konstruktoren ermöglichen die Erstellung eines Tags aus einem 32-Bit-Integer- oder String-Wert und geben std::nullopt zurück, wenn die Eingabe ungültig ist.

Siehe auch QFont::setFeature() und QFont::featureTags().

Dokumentation der Mitgliedsfunktionen

[constexpr noexcept] Tag::Tag()

Standard-Konstruktor, der ein ungültiges Tag erzeugt.

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

Konstruiert ein Tag aus einem String-Literal, str. Das Literal muss genau vier Zeichen lang sein.

font.setFeature("frac", 1);

Siehe auch fromString() und fromValue().

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

Gibt ein Tag zurück, das aus der Zeichenkette in view konstruiert wurde. Die Zeichenkette muss genau vier Zeichen lang sein.

Gibt std::nullopt zurück, wenn die Eingabe nicht vier Zeichen lang ist oder wenn das erzeugte Tag ungültig wäre.

Siehe auch isValid() und fromValue().

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

Gibt ein aus value konstruiertes Tag zurück, oder std::nullopt, wenn das erzeugte Tag ungültig wäre.

Siehe auch isValid().

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

Gibt zurück, ob die Markierung gültig ist. Ein Tag ist gültig, wenn sein Wert nicht Null ist.

Siehe auch value(), fromValue(), und fromString().

QByteArray Tag::toString() const

Gibt die String-Repräsentation dieses Tags als Byte-Array zurück.

Siehe auch fromString().

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

Gibt den numerischen Wert dieses Tags zurück.

Siehe auch isValid() und fromValue().

Verwandte Nicht-Mitglieder

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

Vergleichen Sie lhs mit rhs für Gleichheit und Ordnung.

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

Gibt den Hash-Wert für key zurück, wobei seed als Startwert für die Berechnung verwendet wird.

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