//错误写法:
// const char *device = ((ui->portComboBox->currentText()).toStdString()).data(); //读取串口名
//正确写法:
QString str = ui->portComboBox->currentText();
QByteArray byte = str.toLocal8Bit();
const char *device = byte.data(); //读取串口名
qDebug()<
按照错误写法: 连写 不会报错,运行时读设备号为 0
按照正确写法:分开写 运行能够正确读取设备号