Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How use different proxies for each QTwebview browser control in an application ?
Forum Updated to NodeBB v4.3 + New Features

How use different proxies for each QTwebview browser control in an application ?

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zain
    wrote on last edited by
    #1

    Hello All,

    I am developing an application that opens some sites on different-different QTwebview browser controls(for example 4 QTwebview browser).

    Is it possible to use different proxy with each QTwebview browser ?

    I am using below code to use proxy :-

    @QNetworkProxy proxy;
    proxy.setType(QNetworkProxy::HttpProxy);
    proxy.setHostName(proxyName);
    proxy.setPort(8080);
    QNetworkProxy::setApplicationProxy(proxy);@

    Thanks in advance
    Zain

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      You can obtain the "QWebPage":http://qt-project.org/doc/qt-5.0/qtwebkit/qwebpage.html from your "QWebView":http://qt-project.org/doc/qt-5.0/qtwebkit/qwebview.html using method page() and then to change the network access manager of the "QWebPage":http://qt-project.org/doc/qt-5.0/qtwebkit/qwebpage.html using method "setNetworkAccessManager":http://qt-project.org/doc/qt-5.0/qtwebkit/qwebpage.html#setNetworkAccessManager. Please note the remark at the documentation:

      bq. 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.

      So it is a tricky and as you said you should try using separate QWebViews with separate QWebPages and separate "QNetworkAccessManagers":http://qt-project.org/doc/qt-5.0/qtnetwork/qnetworkaccessmanager.html

      http://anavi.org/

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zain
        wrote on last edited by
        #3

        Hi,

        Thanks for your answer, I am trying your suggestion and will let you know it is working or not.

        Thanks again

        Zain

        1 Reply Last reply
        0
        • L Offline
          L Offline
          leon.anavi
          wrote on last edited by
          #4

          [quote author="Zain" date="1357210708"]Thanks for your answer, I am trying your suggestion and will let you know it is working or not.
          [/quote]

          OK, I forgot to note that you should call method "setProxy":http://qt-project.org/doc/qt-5.0/qtnetwork/qnetworkaccessmanager.html#setProxy to specify which proxy should your network access manager use.

          http://anavi.org/

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            Zain
            wrote on last edited by
            #5

            Thanks for the tip.

            Just for your information, here I am talking about more than 1 proxy at a time!!

            Just wondering is it possible in QT ?

            Thanks
            Zain

            1 Reply Last reply
            0
            • L Offline
              L Offline
              leon.anavi
              wrote on last edited by
              #6

              [quote author="Zain" date="1357212185"]Just for your information, here I am talking about more than 1 proxy at a time!!
              [/quote]

              Yes, I understand you. As I noted in my previous post at the moment it is not possible to change the proxy after the QWebPage has already used it but you can try to use separate instances of QWebViews and QWebPages.

              http://anavi.org/

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                Zain
                wrote on last edited by
                #7

                Hi leon.anavi,

                Thank you very much for your help.

                Now I am working in direction as you suggest.

                Really appreciate your quick help.

                Thanks
                Zain :-)

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  leon.anavi
                  wrote on last edited by
                  #8

                  [quote author="Zain" date="1357213603"]
                  Thank you very much for your help.

                  Now I am working in direction as you suggest.

                  Really appreciate your quick help.
                  [/quote]

                  You are welcome. Good luck with the implementation and after that please share your experience and results :)

                  http://anavi.org/

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    Zain
                    wrote on last edited by
                    #9

                    Hi

                    Now I want to run multiple webView in multiThreads

                    Thanks

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved