PDA

View Full Version : Cannot open webpage with QWebView



szyema
13th January 2010, 05:22
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.

kichi
13th January 2010, 08:07
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 ?

szyema
13th January 2010, 08:46
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.

ansar
13th January 2010, 10:07
I am facing the same problem with loading the web page in QWebView......Please anybody to help it out.....

mph
24th February 2012, 11:24
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

Spitfire
24th February 2012, 13:45
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:

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QWebView *my_web;

my_web = new QWebView(this);
my_web->setGeometry(100,100,1000,1000);
my_web->load(QUrl("http://www.google.com/"));
this->setCentralWidget( my_web );
}
Ps use [CODE] tags in future.

mph
27th February 2012, 05:43
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

ChrisW67
27th February 2012, 08:33
Build and run this:


#include <QtGui/QApplication>
#include <QtWebKit/QWebView>

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

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

Does it work?

mph
27th February 2012, 09:35
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

ChrisW67
27th February 2012, 10:40
There are no magic settings required.

Is your Internet access limited to through a proxy?

mph
27th February 2012, 11:04
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