当前位置:网站首页>QT handy notes (II) edit control and float, qstring conversion
QT handy notes (II) edit control and float, qstring conversion
2022-07-26 09:33:00 【Flying 123_ one hundred and twenty-three】
1、Edit Control
QString qstr = ui->lineEdit->text();// Get current Edit Value on , Assign to qstr.
ui->lineEdit->setText(qstr);// Set up Edit The value on is qstr
2、QString Transfer to other types
QString qstr = “123”;// Definition qstr Value
float valFlo = qstr.toFloat();// take QString convert to float
int valInt = qstr.toInt();// take QString convert to int
double valDou = qstr.toDouble();// take QString convert to doublr
String valStr = qstr.toStdString;// take QString convert to string
3、 Other types of transfer QString
QString qstr;
float valFlo = 11.1111;
qstr = QString::asprintf("%.2f", value);//float turn QString And keep two decimal places ( Retain x Decimal place , The first is %.xf)
边栏推荐
猜你喜欢
面试题目大赏
V-permission add permission
解决npm -v突然失效 无反应
After attaching to the process, the breakpoint displays "currently will not hit the breakpoint, and no symbols have been loaded for this document"
Exception handling mechanism II
Jmeter配置元件之CSV数据文件设置
高斯消元求解矩阵的逆(gauss)
v-premission添加权限
[MySQL] understand the important architecture of MySQL (I)
小程序纪录
随机推荐
Arc GIS basic operation 3
CSV data file settings of JMeter configuration components
正则表达式
电机转速模糊pid控制
arcgis的基本使用1
js中树与数组的相互转化(树的子节点若为空隐藏children字段)
如何添加一个PDB
V-permission add permission
tabbarController的使用
PMM(Percona Monitoring and Management )安装记录
服务器、客户端双认证(2)
Exception handling mechanism II
暑假末尾学习笔记
2020-12-29
asp. Net using redis cache (2)
省政府召开全省高温天气安全防范工作电视电话会议
小白搞一波深拷贝 浅拷贝
Basic use of ArcGIS 1
Implementation of fragment lazy loading after multi-layer nesting
Audio and video knowledge