PDA

View Full Version : Invalid conversion error while Storing into Combobox



owais_blore
17th February 2012, 06:22
Hi I am bit new to QT programming. I am working on server proxy related module where I need to store the result into the combobox. Here goes the example:


QNetworkProxyQuery npq(QUrl(QLatin1String("http://www.google.com")));
QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);

foreach ( QNetworkProxy loopItem, listOfProxies )
{
qDebug() << "ProxyHostName_IP: " << loopItem.hostName();
qDebug()<< "Port: " << loopItem.port();

ui->comb_conf_box->addItem(loopItem.hostName()); //combo box for Host name IP
ui->comb_port_box->addItem(loopItem.port()); // combo box for POrt
}

I am able to receive Host Name IP but Port number doesnt appear. Please help!!!

Eroor thrown is: Invalid conversion from quint16 to const char*

Spitfire
20th February 2012, 16:08
ui->comb_port_box->addItem( QString::number( loopItem.port() ) ); // combo box for POrt