当前位置:网站首页>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)
边栏推荐
猜你喜欢

小白搞一波深拷贝 浅拷贝

Your login IP is not within the login mask configured by the administrator

2019 ICPC Asia Yinchuan Regional(水题题解)

Windows backs up the database locally by command

神经网络与深度学习-6- 支持向量机1 -PyTorch

Personality test system V1.0

asp.net 使用redis缓存

CSV data file settings of JMeter configuration components

高斯消元求解矩阵的逆(gauss)

cocoapods的安装和使用
随机推荐
WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
Use of OpenCV class
Add DLL
服务器环境配置全过程
吴恩达机器学习之线性回归
The problem of the sum of leetcode three numbers
高斯消元求解异或线性方程组
Your login IP is not within the login mask configured by the administrator
调用DLL开启线程的问题
POJ 1012 Joseph
如何添加一个PDB
antUI中a-modal 拖拽功能制作
mysql5.7.25主从复制(单向)
v-for动态设置img的src
配置ADCS后访问certsrv的问题
malloc分配空间失败,并且不返回null
arcgis的基本使用1
a-table中的rowSelection清空问题
The difference between thread join and object wait
微信小程序AvatarCropper 头像裁剪