Results 1 to 11 of 11

Thread: Cannot open webpage with QWebView

  1. #1
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Cannot open webpage with QWebView

    Hi all,

    I try to display webpage with QWebView,but there is nothing on window, it display blank.

    I using QT/Embedded 4.4.3, here is my test codes:

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

    QWebView *view = new QWebView;
    view->load(QUrl("http://www.google.com"));
    view->show();
    return app.exec();
    }

    Thanks for reply.

  2. #2
    Join Date
    Nov 2007
    Posts
    31
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot open webpage with QWebView

    I tried your code on Linux/LGPL/Qt4.6.
    I included headers, and added "QT += webkit" to the project file(.pro).
    It worked fine.

    Is there any warning message on the build ?
    kichi

  3. #3
    Join Date
    Jan 2010
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Cannot open webpage with QWebView

    Thanx for reply .

    "QT += webkit" has been added into the project file.
    The build has no any problem.

    I think maybe something block the connect ?
    But the network is available, I can use FTP and HTTP tools from QT Demos downloaded file.
    Last edited by szyema; 13th January 2010 at 09:20.

  4. #4
    Join Date
    Dec 2009
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Cannot open webpage with QWebView

    I am facing the same problem with loading the web page in QWebView......Please anybody to help it out.....

  5. #5
    Join Date
    Feb 2012
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Cannot open webpage with QWebView

    hi,
    I am using QtSDK 4.7.4 on Open Suse linux. I am trying a simple progrm to open a web page using QWebView, but it is showing blank page, Can anyone help me where I am going wrong. I have added QT += webkit in pro file and my code is,

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    QWebView *my_web;

    my_web = new QWebView(this);
    my_web->setGeometry(100,100,1000,1000);
    my_web->load(QUrl("http://www.google.com/"));
    my_web->show();

    }


    Please help me.

    Regards,
    MPH

  6. #6
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Cannot open webpage with QWebView

    If you have your web view in the ui, then use that view instead of creating new one.

    If not, then remove setting up the ui and use setCetralWidget instead, for example:
    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent)
    2. : QMainWindow(parent)
    3. {
    4. QWebView *my_web;
    5.  
    6. my_web = new QWebView(this);
    7. my_web->setGeometry(100,100,1000,1000);
    8. my_web->load(QUrl("http://www.google.com/"));
    9. this->setCentralWidget( my_web );
    10. }
    To copy to clipboard, switch view to plain text mode 
    Ps use [CODE] tags in future.

  7. #7
    Join Date
    Feb 2012
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Cannot open webpage with QWebView

    Hi,
    I am not using ui's web view. I have tried adding the below line to the code, but its the same white blank page.

    this->setCentralWidget( my_web );

    It is not connecting to the internet, so I am not able to see Google home page. My net connection is fine.


    regards,
    MPH

  8. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Cannot open webpage with QWebView

    Build and run this:
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QtWebKit/QWebView>
    3.  
    4. int main(int argc, char * argv[])
    5. {
    6. QApplication app(argc, argv);
    7.  
    8. QWebView view;
    9. view.load(QUrl("http://www.google.com"));
    10. view.show();
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    Does it work?

  9. #9
    Join Date
    Feb 2012
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Cannot open webpage with QWebView

    Hi Chris,
    Still getting blank page, I am working on Open Suse operating system. can u tell me any respective settings do I need to do in Suse?




    regards,
    MPH

  10. #10
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Cannot open webpage with QWebView

    There are no magic settings required.

    Is your Internet access limited to through a proxy?

  11. #11
    Join Date
    Feb 2012
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Cannot open webpage with QWebView

    Yes, limited acces for us here. after seeing your mail i tried setting as given in the below link

    http://doc.trolltech.com/4.1/qnetworkproxy.html

    but still not connecting to net.

    regards,
    MPH
    Last edited by mph; 27th February 2012 at 11:05.

Similar Threads

  1. Problem with downloading a webpage
    By Fenix Voltres in forum Newbie
    Replies: 2
    Last Post: 25th June 2009, 19:55
  2. qt gui application on webpage
    By bcheruk in forum Qt Programming
    Replies: 4
    Last Post: 23rd April 2009, 20:03
  3. opening webpage using qt....
    By anupamgee in forum Qt Programming
    Replies: 8
    Last Post: 20th April 2009, 11:13
  4. Can't get webpage to open using 'QHttp'
    By rishiraj in forum Newbie
    Replies: 6
    Last Post: 30th January 2009, 10:24
  5. is it possible to save a webpage as an image?
    By billconan in forum Qt Programming
    Replies: 2
    Last Post: 8th July 2008, 01:08

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.