PDA

View Full Version : Getting windows internet proxy settings



jdd81
10th June 2009, 17:18
Is there any way in Qt to query for windows proxy settings that could then be fed into QNetworkProxy::setApplicationProxy? I would like to be able to get and use the same proxy settings as internet explorer in my application.

jdd81
10th June 2009, 19:37
It looks like QNetworkProxyFactory::systemProxyForQuery should work for this, but It is not returning the proxy that I expect.



QNetworkProxyQuery q;
q.setQueryType(QNetworkProxyQuery::UrlRequest);
q.setProtocolTag("http");

QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery(q);
if( proxies.size() > 0 && proxies[0].type() != QNetworkProxy::NoProxy )
QNetworkProxy::setApplicationProxy(proxies[0]);
else
qDebug("No proxy server selected");


I always get back a single item in the list with NoProxy for type. Any ideas?

jdd81
10th June 2009, 22:27
Turns out it works if you add a url to the query.