このページでは

QTextDecoder Class

QTextDecoder クラスは、状態ベースのデコーダを提供します。詳細...

ヘッダー: #include <QTextDecoder>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core5Compat)
target_link_libraries(mytarget PRIVATE Qt6::Core5Compat)
qmake: QT += core5compat

注:このクラスのすべての関数は再入可能である。

パブリック関数

QTextDecoder(const QTextCodec *codec)
QTextDecoder(const QTextCodec *codec, int flags)
~QTextDecoder()
QString toUnicode(const char *chars, int len)
QString toUnicode(const QByteArray &ba)
void toUnicode(QString *target, const char *chars, int len)

詳細な説明

テキストデコーダは、特定のコーデックを使用して、エンコードされたテキスト形式のテキストを Unicode に変換します。

このデコーダは、呼び出し間で必要な状態を記憶しながら、この形式のテキストを Unicode に変換します。

QTextCodec::makeDecoder() およびQTextEncoderも参照してください 。

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

[explicit] QTextDecoder::QTextDecoder(const QTextCodec *codec)

指定されたcodec に対するテキストデコーダを構築します。

[explicit] QTextDecoder::QTextDecoder(const QTextCodec *codec, int flags)

指定されたcodec および変換flags に対して、テキストデコーダを構築します。

[noexcept] QTextDecoder::~QTextDecoder()

デコーダを破壊する。

QString QTextDecoder::toUnicode(const char *chars, int len)

chars の先頭からlen バイト分をUnicodeに変換し、その結果を返します。

すべての文字が使用されていない場合(たとえば、文字の末尾にマルチバイトエンコーディングの一部のみが存在する場合など)、デコーダは、この関数の次の呼び出しを継続するのに十分な状態を保持します。

QString QTextDecoder::toUnicode(const QByteArray &ba)

ba で指定されたバイト配列内のバイトを Unicode に変換し、その結果を返します。

これはオーバーロードされた関数です。

void QTextDecoder::toUnicode(QString *target, const char *chars, int len)

変換された文字列は、target で返されます。

これはオーバーロードされた関数です。

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