Results 1 to 4 of 4

Thread: Set a proxy for QWebView

  1. #1
    Join Date
    Mar 2010
    Location
    Italy, Rome
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Set a proxy for QWebView

    hi everibody,

    I'm dealing with a simple browser application, like the one in FancyBrowser example in the normal webkit package. Used classes are QWebView and QWebPage.
    My problem is that I must use a proxy for the internet connection. How can I set a proxy (hostname, port, ...) in my application? Any examples?

    Thank you in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Set a proxy for QWebView

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2010
    Location
    Italy, Rome
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Set a proxy for QWebView

    OK, it works,
    Thank you.

    Here the code I used:
    Qt Code:
    1. proxy.setType(QNetworkProxy::Socks5Proxy);
    2. proxy.setType(QNetworkProxy::HttpProxy);
    3. proxy.setHostName("proxy.example.com");
    4. proxy.setPort(1080);
    5. // proxy.setUser("username");
    6. // proxy.setPassword("password");
    7. QNetworkProxy::setApplicationProxy(proxy);
    To copy to clipboard, switch view to plain text mode 

    Andrea


    Added after 6 minutes:


    Hi wysota,
    thank again for your help.

    Now I've got a more complicate challenge.

    In my company there's a proxy for the web navigation. For internet sites I must use the proxy, but for the internal web servers (like http://192.168.13.49) I must not use the proxy.
    In firefox and other commercial browsers, I can del with the proxy exceptions. In the connection settings panel I can set a proxy address and some exceptional addresses for which the proxy shall not be used.

    Do you think is possible to do such thing with my Qt browser?
    Thank you again from Italy.
    Last edited by andzoff; 13th May 2011 at 15:20.

  4. The following user says thank you to andzoff for this useful post:

    dientuvnn (16th November 2011)

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Set a proxy for QWebView

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 8
    Last Post: 3rd September 2013, 10:51
  2. How exactly to use proxy in socket?
    By Passerby in forum Newbie
    Replies: 1
    Last Post: 3rd July 2009, 10:24
  3. Get source of next row in proxy
    By supergillis in forum Qt Programming
    Replies: 2
    Last Post: 16th November 2008, 17:42
  4. Proxy problem
    By MrShahi in forum Qt Programming
    Replies: 1
    Last Post: 23rd June 2008, 17:11
  5. Proxy for TreeView
    By patrikd in forum Qt Programming
    Replies: 5
    Last Post: 8th February 2008, 20:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.