I have an application that has "Account" objects that store information such as cookies and a proxy used for the account. When I make a network request through QNetworkAccessManager for each of these accounts I have been using the QNetworkAccessManager setProxy() method just prior to making the request. I had originally tried to create a proxy factory for this, however I don't seem to have any control over the QNetworkProxyQuery object that gets passed into the factory methods, so no way to differentiate which "Account" a particular request is for since the url/port/QueryType, etc might be the same for multiple accounts. I didn't see any way to subclass QNetworkProxyQuery to pass around an "Account" pointer that I could use within the factory methods to know which proxy a particular request was for, since the creation of the QNetworkProxyQuery objects all happen in internal methods/classes.

So I ended up with just using setProxy() as mentioned above, and that worked out just fine for my needs.

However, now that I am also implementing in Qt WebEngine into my application, things are getting a bit more difficult. What I need to do is launch a particular QtWebEngineView/Page using the proxy an "Account" specifies. I have read https://wiki.qt.io/QtWebEngine/Network and found out the WebEngine uses the applicationProxy to determine which proxy to use. So at first I thought I could just do a similar thing I've been doing with QNAM and just call setApplicationProxy() just prior to creating the WebEngineView/Page and calling load(). But I started digging into the source and found out that Chromium seems to periodically call the function OnLazyPoll() to get the current applicationProxy (https://code.woboq.org/qt5/qtwebengi...t.cpp.html#148) and if it has been changed since the last time it got polled, it seems it would change the proxy across all webviews that you would have loaded.

This is a problem, since I need to maintain the proxy I have set when I loaded the view. So that threw out the idea of using setApplicationProxy(). The only solution I can think of at this point is to completely separate each created WebEngineView into a QProcess with it's own QApplication instance that I can use with setApplicationProxy(). I had originally wanted to make each WebEnginePage a tab in my main application, but going this route I don't think I can do it. Unless there is some IPC classes that can make each "tab" it's own process WITHIN the main running application (not a separate window).

Any ideas/tips on what I can do to solve this problem would be appreciated.

Thanks