[SOLVED] Can we set specific Network proxy for QWebView
I am having one application where I am creating multiple QWebView objects.
Since each QWebView object is loading different URL , and my network admin wanted to route the specific url through some proxy.
I have one function QNetworkProxy::setApplicationProxy(), which will set the proxy for the entire app, i.e. all QWebView will use that proxy , but I wanted to use different proxy for different QWebView.
Please advice how can we achieve this.
Please help it is very urgent!!!!!
5 replies
I think that the official Qt documentation offers a solution for your request [qt-project.org]:
An alternative to setting an application wide proxy is to specify the proxy for individual sockets using QAbstractSocket::setProxy() and QTcpServer::setProxy(). In this way, it is possible to disable the use of a proxy for specific sockets using the following code:
Have you seen this thread at stackoverflow [stackoverflow.com]?
It highlights the documentation about QWebPage [qt-project.org] and method setNetworkAccessManager [qt-project.org]:
Note: It is currently not supported to change the network access manager after the QWebPage has used it. The results of doing this are undefined.
The recommended solution at stackoverflow.com [stackoverflow.com] to create QNetworkAccessManager, set up a proxy and then to pass it to the web page seems reasonable.
Thanks a lot leon!!!!!!!!!!!!You made my life really cool.
I am being able to set the different proxy for different Qwebview inside a single application.
your solution simply rockzz!!!!!!!!
You are welcome :) I am glad that the issue was solved but please note that I got the idea from a thread at stackoverflow.com [stackoverflow.com].
You must log in to post a reply. Not a member yet? Register here!


