QLatin1String类对US-ASCII/Latin-1编码的字符串进行了简单封装,可理解为关于const char*的一个浅封装。
当在 .pro 文件中定义了 QT_NO_CAST_FROM_ASCII 时,使用类似 QString str = “hello” 的操作就会报错,此时就需要借助QLatin1String类来进行转换了。
QString str = QLatin1String("hello");
QLatin1String类对US-ASCII/Latin-1编码的字符串进行了简单封装,可理解为关于const char*的一个浅封装。
当在 .pro 文件中定义了 QT_NO_CAST_FROM_ASCII 时,使用类似 QString str = “hello” 的操作就会报错,此时就需要借助QLatin1String类来进行转换了。
QString str = QLatin1String("hello");