以下为代码:
QString temp3;
[pre][/pre][pre] bool ok1,ok2;[/pre][pre][/pre][pre] QByteArray temp = myCom ->readAll();[/pre][pre][/pre][pre] ui->textBrowser->insertPlainText(temp);[/pre][pre][/pre][pre] temp3 =QString(temp.mid(1,15));[/pre][pre][/pre][pre] // qDebug()<<temp3;[/pre][pre][/pre][pre] int temptest2 = temp3.toInt(&ok1,10);[/pre][pre][/pre][pre] qDebug()<<temptest2;[/pre][pre][/pre][pre] int temptar3 = ui->tarValLineEdit->text().toInt(&ok2,10);[/pre][pre][/pre][pre] temptar3 = temptar3*1000;[/pre][pre]从串口读回的QByteArray数据转换为Qstring再使用.toInt转化为Int后qDebug()<<temptest2始终输出为0!!![/pre][pre]各位大虾求助哇~~~~~[/pre]