Unsolved Setting User And Password For Qt WebView & WebEngine Diectly
Hi. I wanted to set user and password for Qt WebView & WebEngine directly. I have my own VPS and I have setup HttpProxy on it. My application has a web browser and I want that web browser to use the http proxy. I've tried setting application proxy but the web view raises a dialog asking for user and password. I want to set user and password in the code so that users won't have to deal with the dialog.
@shahriar25 are you talking about user/password for a proxy, so your QWebView application can traverse such proxy, which requires authentication, and reach the desired destination?
If so, I imagine you may need to rely on using a QNetworkProxyFactory that once configured properly (for instance, to use the system proxy's settings) is then set to the QNetworkAccessManager that makes the connection
Thank you for replying and helping.
I tried using QNetworkProxyFactory:
class ProxyFactory : public QNetworkProxyFactory
QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
QNetworkProxy proxy; proxy.setType(QNetworkProxy::HttpProxy); // set proxy variables here return QList<QNetworkProxy>() << proxy; }
but this doesn't work. I mean it proxies QNetworkAccessManager and stuff but it is not what I want.
I want the webview to use this proxy and not raise a dialog and ask the user for credentials.
Well see that is the problem. I'm working with qml and using webview in it
Hi. I'm sorry for late reply
I'm sorry if I left out using qml. It wasn't intentional
I tried this:
class QmlNAMFactory : public QQmlNetworkAccessManagerFactory
virtual QNetworkAccessManager *create(QObject *parent)
QNetworkAccessManager *nam = new QNetworkAccessManager(parent);
proxy.setType(QNetworkProxy::HttpProxy); // proxy info here nam->setProxy(proxy); return nam; }
but this has no effect on webview. It doesn't change a thing
I'm sorry the function was returning nullptr I edited it. I did that just to text the effect
Isn't there anything that I can do?
i.n.g.o. last edited by
Did you solve the problem?
I am hitting the same problem, i need to set a header to every QML WebView request.
Setting the network access manager on
QQmlApplicationEnginedoes not call
Seems WebView is not using
Is this possible at all?
thanks for hints.