Qt之setCodecForLocale

来源:互联网 发布:产品跟踪软件 编辑:程序博客网 时间:2024/05/18 15:05

setCodecForLocale

void QTextCodec::setCodecForLocale ( QTextCodec * c ) [static]Set the codec to c; this will be returned by codecForLocale(). If c is a null pointer, the codec is reset to the default.This might be needed for some applications that want to use their own mechanism for setting the locale.

这个应该没什么好说的,在绝大多数情况下,我们在代码中应该都用不到这个函数(默认的system应该比我们所能设置的要好)。

  • 当我们从程序的命令行读取参数时int main(int argc, char *argv[])

  • 当我们从往控制台输出内容时qDebug()<<QString(...)

  • 使用 QString::fromLocal8Bit() 与 QString::toLocal8Bit()
  • ...