unable to enumerate the list of comports in combobox with qt5.1.0 with QtSerialport
Hi , trying to enumerate the list of available comports in system into a combobox and i have pasted my code below,
ui->setupUi(this);
foreach (const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts())
{
foreach (QString s,serialPortInfo.availablePorts())
{
ui->comboBox->addItem(s);
}
}
And i am geeting a error ,
error: conversion from 'const QSerialPortInfo' to non-scalar type 'QString' requested
please give me some solutions to how to sort out this error, Thanks in advance
Re: unable to enumerate the list of comports in combobox with qt5.1.0 with QtSerialpo
You inner loop tries to do the same thing as the outer loop (iterate over QSerialPortInfo::availablePorts()), but tries to convert QSerialPortInfo into QString.
You probably don't want that inner loop at all, but add the serial port info's portName() to the combobox.
Cheers,
_
Re: unable to enumerate the list of comports in combobox with qt5.1.0 with QtSerialpo
Thanks anda_skoa... cheers..