string与QString之间的转换(两种方法:fromStdString直接转换,或者fromLocal8Bit(cstr.c_str())
2023-09-11 14:19:08 时间
string str;
QString qstr;
//从QString 到 std::string
str = qstr.toStdString();
//从std::string 到QString
qstr = QString::fromStdString(str);
-------------------------------------------------------------
std::string cstr;
QString qstring;
//从std::string 到QString
qstring = QString(QString::fromLocal8Bit(cstr.c_str()));
//从QString 到 std::string
cstr = string((const char *)qstring.toLocal8Bit());
https://blog.csdn.net/hellokandy/article/details/55254071
相关文章
- PHP使用http_build_query()构造URL字符串的方法(可将POST参数组转换拼接成GET请求链接)
- Ext.util.Format.date与Ext.Date.format区别, 转换时间戳
- python正常时间和unix时间戳相互转换的方法
- 文本字符串与 URL 编码的字符串间的转换
- 使用ToDateTime方法转换日期显示格式
- Python中转换角度为弧度的radians()方法
- python正常时间和unix时间戳相互转换的方法
- js 将json字符串转换为json对象的方法解析
- spring boot: 通过filter过滤器实现中文的简体繁体字符集转换(spring boot 2.3.1)
- OpenCV每日函数 杂项图像转换模块 (6) threshold图像阈值化函数
- 使用showdown.js将Markdown文档转换为HTML
- Atitit 字符串转换数组main参数解析 args splitByWholeSeparator String string=" -host 101.1 8*124 -db 1
- Python语言学习:Python语言学习之python包/库package的简介(模块的封装/模块路径搜索/模块导入方法/自定义导入模块实现华氏-摄氏温度转换案例应用)、使用方法、管理工具之详细攻略
- Python语言学习:Python语言学习之python包/库package的简介(模块的封装/模块路径搜索/模块导入方法/自定义导入模块实现华氏-摄氏温度转换案例应用)、使用方法、管理工具之详细攻略
- vue-cli3.0 使用postcss-plugin-px2rem(推荐)和 postcss-pxtorem(postcss-px2rem)自动转换px为rem 的配置方法;
- php 日期格式转换万能公式
- Python - 缩写(capwords) 和 创建转换表(maketrans) 详细说明
- 激光点云格式转换 bin 相互 pcd转换
- Android.mk转换到Android.bp方法(二十九)
- Swift中NSData与NSDictionary之间的相互转换
- DataTable转换List<T>集合的方法
- 方法2—并行数据流转换为一种特殊串行数据流模块的设计