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)も参照してください 。
© 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.