tags:

views:

990

answers:

2

I have the following code that I am trying to extract the systems proxy settings from:

QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery();
foreach ( QNetworkProxy loopItem, listOfProxies ) {
 qDebug() << "proxyUsed:" << loopItem.hostName();
}

I only get one item back and with a blank host name. Any ideas what I am missing?

A: 

By putting:

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

I appear get the proxy out.

Phil Hannent
+1  A: 

QNetworkProxyQuery npq(QUrl(QLatin1String("http://www.google.com")));

Don't forget to use QLatin1String :)

Salil