Obsolete Members for QtLiterals

QtLiterals クラスの以下のメンバーは非推奨となっています。これらは、古いソースコードが動作し続けるように提供されているものです。新しいコードでの使用は強く推奨しません。

関数

(since 6.2, deprecated in 6.8) QByteArray operator""_qba(const char *str, size_t size)
(since 6.2, deprecated in 6.8) QString operator""_qs(const char16_t *str, size_t size)

関数のドキュメント

[noexcept, since 6.2, deprecated in 6.8] QByteArray operator""_qba(const char *str, size_t size)

この関数はバージョン 6.8 以降、非推奨となっています。新しいコードでの使用は強く推奨しません。

代わりに、Qt::StringLiterals 名前空間の `_ba ` を使用してください。

文字列リテラルstr の先頭size 文字から、QByteArray を作成するリテラル演算子です。

QByteArray はコンパイル時に生成され、生成された文字列データはコンパイル済みオブジェクトファイルの読み取り専用セグメントに格納されます。重複するリテラルは、同じ読み取り専用メモリを共有する場合があります。この機能はQByteArrayLiteral と互換性がありますが、コード内に多くの文字列リテラルが存在する場合、入力の手間を省くことができます。

以下のコードは、QByteArray を作成します:

auto str = "hello"_qba;

この関数は Qt 6.2 で導入されました。

QByteArrayLiteral およびQtLiterals::operator""_qs(const char16_t *str, size_t size)も参照してください 。

[noexcept, since 6.2, deprecated in 6.8] QString operator""_qs(const char16_t *str, size_t size)

この関数はバージョン 6.8 以降、非推奨となっています。新しいコードでの使用は強くお勧めしません。

代わりに、Qt::StringLiterals 名前空間の `_s ` を使用してください。

char16_t 文字列リテラル `str` の先頭 `size ` 文字から `QString ` を作成するリテラル演算子です。

QString はコンパイル時に生成され、生成された文字列データはコンパイル済みオブジェクトファイルの読み取り専用セグメントに格納されます。重複するリテラルは、同じ読み取り専用メモリを共有する場合があります。この機能はQStringLiteral と互換性がありますが、コード内に多くの文字列リテラルが存在する場合、入力の手間を省くことができます。

以下のコードは、QString を作成します:

auto str = u"hello"_qs;

この関数は Qt 6.2 で導入されました。

QStringLiteral およびQtLiterals::operator""_qba(const char *str, size_t size)も参照してください 。

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