我已经成功构建了静态Qt库,我可以看到插件/编解码器/ libqcncodecs.a,但我还是不能像这样使用GB18030:
QTextCodec::codecForName("GB18030")
并且我仍然无法通过
找到与中文相关的编解码器foreach (int mib, QTextCodec::availableMibs()) {
QTextCodec *codec = QTextCodec::codecForMib(mib);
QString sortKey = codec->name().toUpper();
qDebug()<<sortKey;
}
这是我的应用程序的输出:
"SYSTEM"
"UTF-8"
"ISO-8859-1"
"ISO-8859-15"
"UTF-32LE"
"UTF-32BE"
"UTF-32"
"UTF-16LE"
"UTF-16BE"
"UTF-16"
"MULELAO-1"
"ROMAN8"
"TIS-620"
"WINSAMI2"
"APPLE ROMAN"
"WINDOWS-1258"
"WINDOWS-1257"
"WINDOWS-1256"
"WINDOWS-1255"
"WINDOWS-1254"
"WINDOWS-1253"
"WINDOWS-1252"
"WINDOWS-1251"
"WINDOWS-1250"
"IBM866"
"IBM874"
"IBM850"
"ISO-8859-16"
"ISO-8859-14"
"ISO-8859-13"
"ISO-8859-10"
"ISO-8859-9"
"ISO-8859-8"
"ISO-8859-7"
"ISO-8859-6"
"ISO-8859-5"
"ISO-8859-4"
"ISO-8859-3"
"ISO-8859-2"
"KOI8-U"
"KOI8-R"
"ISCII-MLM"
"ISCII-KND"
"ISCII-TLG"
"ISCII-TML"
"ISCII-ORI"
"ISCII-GJR"
"ISCII-PNJ"
"ISCII-BNG"
"ISCII-DEV"
"TSCII"
如何添加中文textcodecs?
答案 0 :(得分:1)
documentation说:&#34;要静态链接这些插件,您需要在应用程序中使用Q_IMPORT_PLUGIN()宏,并且需要使用QTPLUGIN将所需的插件添加到构建中。&# 34;
我认为您在申请中缺少Q_IMPORT_PLUGIN(qcncodecs)
。