Results 1 to 9 of 9

Thread: opening webpage using qt....

  1. #1
    Join Date
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default opening webpage using qt....

    hi all,
    I hv some problem in opening the webpage using qtwebkit module..
    I am using internet in a NAT environment.
    i used the following code:

    Qt Code:
    1. Widget::Widget(QWidget *parent): QWidget(parent)
    2. {
    3. proxy.setHostName("10.8.58.40");
    4. proxy.setPort(8080);
    5. QNetworkAccessManager *manager=new QNetworkAccessManager(this);
    6. manager->setProxy(proxy);
    7. QUrl url;
    8. url.setUrl("http://www.google.co.in");
    9. QWebPage *page=new QWebPage();
    10. page->mainFrame()->load(url);
    11. QWebView *view = new QWebView(this);
    12. view->setPage(page);
    13. view->show();
    14. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 16th April 2009 at 11:40. Reason: missing [code] tags

  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: opening webpage using qt....

    You are created a network access manager and setting a proxy on it but QWebView never uses this object so it doesn't pick up the proxy. I'd try with QNetworkProxy::setApplicationProxy instead.
    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
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: opening webpage using qt....

    Thanx for reply .
    can u explain this with the help of code .As i hv tried this also but didnt work for me .

  4. #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: opening webpage using qt....

    I have a better idea - you explain what you did in code and I'll say what you did wrong (if anything).
    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.


  5. #5
    Join Date
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: opening webpage using qt....

    hi,

    i used this code:

    #include <QApplication>
    #include <QWebView>

    int main(int argc, char **argv)
    {
    QApplication app(argc, argv);

    QWebView *view = new QWebView();
    view->load(QUrl("http://www.webstandards.org/files/acid2/test.html"));
    view->show();

    return app.exec();
    }

    but it is not showing the webpage.it is showing an empty widget.I want to change the proxy settings .
    i tried that and i posted that code in my first post.
    how to change the proxy settings of qwebview??
    plzz help n tell me how to load a webpage and how to change proxy settings..

  6. #6
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: opening webpage using qt....

    read once again what wysota posted already... the solution is already there!
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  7. #7
    Join Date
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: opening webpage using qt....

    i used QNetworkProxy::setApplicationProxy() also. but still code doesn't work..

    Widget::Widget(QWidget *parent): QWidget(parent)
    {
    QNetworkProxy proxy;
    proxy.setType(QNetworkProxy::HttpProxy);
    proxy.setHostName("10.8.58.40");
    proxy.setPort(8080);
    QNetworkProxy::setApplicationProxy(proxy);
    QWebView *web=new QWebView();
    web->load(QUrl("http://www.google.com"));
    web->show();
    }

  8. #8
    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: opening webpage using qt....

    Which version of Qt do you use? Releases earlier than 4.5.0 don't use applicationwide proxy settings for WebKit. It should work in 4.5.0 (at least it had been said it would work).
    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.


  9. #9
    Join Date
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: opening webpage using qt....

    i am using qt-sdk-2009 ,qtcreator 1.0 based on qt 4.5.........
    but still it is not working.....

Similar Threads

  1. Replies: 9
    Last Post: 23rd August 2012, 01:01
  2. "Error opening framebuffer device"
    By rishiraj in forum Installation and Deployment
    Replies: 8
    Last Post: 1st April 2009, 07:29
  3. Can't get webpage to open using 'QHttp'
    By rishiraj in forum Newbie
    Replies: 6
    Last Post: 30th January 2009, 11:24
  4. Re: Opening Project file Issue in Edyuk
    By philwinder in forum Qt-based Software
    Replies: 6
    Last Post: 5th May 2008, 21:49
  5. Opening swf file in the default browser
    By munna in forum Qt Programming
    Replies: 16
    Last Post: 5th May 2006, 10:33

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.