Reputation: 191
For one of my projects, I made a QWebView. Everything is working fine, but when I use it at school, I get an error because the proxy is not defined. How would I make it possible to auto detect the proxy, like in Firefox and IE?
I've found this in QNetworkProxyFactory
:
setUseSystemConfiguration(bool enable)
But I can't find how to use it.
Upvotes: 8
Views: 4468
Reputation: 4266
Here is a working example of using the system defined proxy:
QNetworkProxyQuery npq(QUrl("http://www.google.com"));
QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
if (listOfProxies.size())
QNetworkProxy::setApplicationProxy(listOfProxies[0]);
Upvotes: 2
Reputation: 992747
Since setUseSystemConfiguration
is a static method, the following might do what you need:
QNetworkProxyFactory::setUseSystemConfiguration(true);
Upvotes: 11