QFont::Tag Struct

struct QFont::Tag

QFont::Tag 、高度なフォント機能にアクセスできる。詳細...

この構造体は Qt 6.7 で導入されました。

パブリック関数

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

静的パブリックメンバー

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)

詳細説明

QFont は、テキストを整形する際の高度な機能へのアクセスを提供する。機能はタグによって定義され、4文字の文字列または32ビットの整数値として表すことができる。この型は、そのようなタグを型安全な方法で表す。この型は、4文字、8ビットの文字列リテラル、または対応する32ビットの整数値から構築することができます。これより短い文字列リテラルや長い文字列リテラルを使用すると、コンパイル時にエラーが発生します。

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

名前付きコンストラクタは、32ビットの整数値または文字列値からタグを作成することができ、入力が無効な場合はstd::nullopt を返します。

QFont::setFeature() およびQFont::featureTags()も参照

メンバ関数のドキュメント

[constexpr noexcept] Tag::Tag()

無効なタグを生成するデフォルトのコンストラクタ。

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

文字列リテラルstr からタグを構築する。リテラルは正確に4文字でなければなりません。

font.setFeature("frac", 1);

fromString() およびfromValue()も参照

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

view の文字列から作られたタグを返す。文字列は正確に4文字でなければならない。

入力が4文字でない場合、または生成されたタグが無効な場合はstd::nullopt を返す。

isValid() およびfromValue()も参照

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

生成されたタグが無効な場合は、value 、またはstd::nullopt から構築されたタグを返す。

isValid()も参照のこと

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

タグが有効かどうかを返す。タグの値がゼロでなければ有効である。

value()、fromValue() およびfromString()も参照

QByteArray Tag::toString() const

このタグの文字列表現をバイト配列で返します。

fromString()も参照ください

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

このタグの数値を返します。

isValid() およびfromValue()も参照

関連する非会員

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

lhsrhs を比較し、平等性と順序性を確認する。

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

key のハッシュ値を返す。計算のシードにはseed を使用する。

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