1     foreach (const QSerialPortInfo &info,QSerialPortInfo::availablePorts())
 2     {
 3            QSerialPort tempSer;
 4            tempSer.setPort(info);
 5            if(tempSer.open(QIODevice::ReadWrite))
 6            {
 7                ui->comboBox->addItem(tempSer.portName());
 8                tempSer.close();
 9            }
10     }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-08-03
  • 2021-11-18
  • 2021-11-18
猜你喜欢
  • 2021-08-20
  • 2022-12-23
  • 2021-09-01
  • 2021-12-01
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案