Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
日本語の文字列を含む QString があります。しかし、デバッグ中に「???」が表示されるだけです 文字列の代わりに。qmlで表示する必要があります。QtextCodec を使用しましたが、うまくいきませんでした。問題を解決するための解決策または提案を教えてください。
これを試しましたか?
label->setText(QString::fromLocal8Bit("日本語"));
ソースファイルを UTF-8 (または文字をエンコードできる他のもの) エンコーディングで保存します
デフォルトのコーデックを設定しますQtextCodec(試してみましたが、この設定なしでも動作しています)。
QtextCodec
使用するlabel->setText(QString::fromWCharArray(L"日本語"));
label->setText(QString::fromWCharArray(L"日本語"));