[ubuntu-jp] Qt アプリケーションで日本語を表示できるフォントは?
shigekazu ozaki
mitararu at gmail.com
Mon Mar 12 11:37:13 GMT 2007
尾崎です。
Qt では文字列を Unicode として扱うようになっています。
ですから、 UTF-8 でエンコーディングされた文字列を表示する場合には、UTF-8 から Unicode への変換が必要になります。
Qt ではこの処理を行ってくれる QTextCodec というクラスがあって、以下は C++ での使用例です。
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QPushButton *quit = new QPushButton(codec->toUnicode("中止"));
これで日本語が正しく表示されると思います。
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-jp/attachments/20070312/5a4dc401/attachment.htm
More information about the ubuntu-jp
mailing list