Hi all!
The examples show code in Terminal project:
//in constructor
fillPortsInfo();
//..//
void Settings::fillPortsInfo()
{
ui->serialPortInfoListBox->clear();
foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
list << info.portName()
<< info.description()
<< info.manufacturer()
<< info.systemLocation()
<<
(info.
vendorIdentifier() ?
QString::number(info.
vendorIdentifier(),
16) : QString()) <<
(info.
productIdentifier() ?
QString::number(info.
productIdentifier(),
16) : QString());
ui->serialPortInfoListBox->addItem(list.first(), list);
}
}
}
//in constructor
fillPortsInfo();
//..//
void Settings::fillPortsInfo()
{
ui->serialPortInfoListBox->clear();
foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
QStringList list;
list << info.portName()
<< info.description()
<< info.manufacturer()
<< info.systemLocation()
<< (info.vendorIdentifier() ? QString::number(info.vendorIdentifier(), 16) : QString())
<< (info.productIdentifier() ? QString::number(info.productIdentifier(), 16) : QString());
ui->serialPortInfoListBox->addItem(list.first(), list);
}
}
}
To copy to clipboard, switch view to plain text mode
How can I display the current port in the QComboBox (serialPortInfoListBox) that I take from the config.ini file?
Now I have the first (or last) port from the list of ports.
Bookmarks