[SOLVED]white screen when calling qwebview widget
hi, all~i'm a newbie to the qt development for Maemo and now totally stucked on the usage of qwebview widget:(
My example code is very simple. But everything get strange when i run it in the maemo emulator, the qwebview displays nothing but a white screen. What i'm sure about is that the qwebview has loaded the content of page. i tried google but got nothing, so i wish i would seek answer here, thanks for your help.
[CODE]#include <QtGui>
#include<QtWebKit>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWebView *view = new QWebView();
view->load(QUrl("http://www.google.com"));
view->show();
QPushButton *ok = new QPushButton("TEST");
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(ok);
layout->addWidget(view);
QWidget *widget = new QWidget();
widget->setLayout(layout);
widget->show();
return app.exec();
}[/CODE]
Re: white screen when calling qwebview widget
hi, i just complied the code on the windows platform by using Qt Creator and the code runs well~ i think this problem may be related to configuration of development environment of linux, i will try to solve the problem in this direction and post my solution if fixed, thanks and also i will appreciate if u can give any advise on this:)
my development environment is CENTOS(linux kernel 2.6.18) + MAEMO 5 + Qt4.6 + ESBOX
Re: white screen when calling qwebview widget
I don't know about Maemo, but for Symbian the default for "color" is white. So text that shows up in black under Creator is white in the emulator or on the device, unless you change the default.
Re: white screen when calling qwebview widget
[QUOTE=hulun499;728517]What i'm sure about is that the qwebview has loaded the content of page.[/QUOTE]
How do you know that?
[QUOTE=hulun499;728517]my development environment is CENTOS(linux kernel 2.6.18) + MAEMO 5 + Qt4.6 + ESBOX[/QUOTE]
Development environment could be MADDE, scratchbox 1, scratchbox 2. Which one do you refer as Maemo 5?
Re: white screen when calling qwebview widget
[QUOTE=danhicksbyron;728881]I don't know about Maemo, but for Symbian the default for "color" is white. So text that shows up in black under Creator is white in the emulator or on the device, unless you change the default.[/QUOTE]
I don't think my problem is related to the default color of text, as the images in google homepage also does not show up~but anyway i will try this and see if any text will be displayed
Re: white screen when calling qwebview widget
[QUOTE=divanov;729120]How do you know that?[/QUOTE]
I caught the signal loadProcess to monitor the loading of webpage and found that the loading indicator was updated.
[QUOTE=divanov;729120]Development environment could be MADDE, scratchbox 1, scratchbox 2. Which one do you refer as Maemo 5?[/QUOTE]
i used the scratchbox 1 for development
Re: white screen when calling qwebview widget
newfound!
The code works fine when i disable the composite extension by adding the parameter '-extension Composite' to the Xephyr command. It seems that it is hard for maemo to render the html content when using qwebview widget on my pc~any idea?
Re: white screen when calling qwebview widget
I've developed small test application
[CODE]#ifndef MAIN_H
#define MAIN_H
#include <QtGui>
#include <QtWebKit>
class View : public QMainWindow
{
Q_OBJECT
public:
View(QWidget *parent = 0);
private slots:
void loadFinished(bool ok);
private:
QWebView *view;
QPushButton *ok;
};
#endif // MAIN_H
[/CODE]
[CODE]
#include "main.h"
View::View(QWidget *parent) : QMainWindow(parent)
{
ok = new QPushButton("Test");
view = new QWebView();
connect(view, SIGNAL(loadFinished(bool)), SLOT(loadFinished(bool)));
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(ok);
layout->addWidget(view);
QWidget *widget = new QWidget();
widget->setLayout(layout);
setCentralWidget(widget);
view->load(QUrl("http://www.google.com"));
}
void View::loadFinished(bool ok)
{
qDebug() << __PRETTY_FUNCTION__ << ok;
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
View view;
view.show();
return app.exec();
}
[/CODE]
That's what I get when I run it:
> run-standalone.sh $(pwd)/webkit3
webkit3[7520]: GLIB CRITICAL ** Gtk - gtk_widget_set_sensitive: assertion `GTK_IS_WIDGET (widget)' failed
QMaemoInternetConnectivity has received an error message.
Name: "org.freedesktop.DBus.Error.ServiceUnknown"
Message: "The name com.nokia.icd was not provided by any .service files"
NOTE: Please ignore this error message if you are running your application in scratchbox
Warning: Qt GConf backend has got a NULL value for the key: "/system/osso/connectivity/IAP/last_used_network"
QMaemoInternetConnectivity has received an error message.
Name: "org.freedesktop.DBus.Error.ServiceUnknown"
Message: "The name com.nokia.icd_ui was not provided by any .service files"
NOTE: Please ignore this error message if you are running your application in scratchbox
void View::loadFinished(bool) false
Re: white screen when calling qwebview widget
i got the below message when i run my example code
[QUOTE]
[COLOR="Red"]HelloWorld[2855]: GLIB CRITICAL ** Gtk - gtk_widget_set_sensitive: assertion `GTK_IS_WIDGET (widget)' failed[/COLOR]
QMaemoInternetConnectivity has received an error message.
Name: "org.freedesktop.DBus.Error.ServiceUnknown"
Message: "The name com.nokia.icd was not provided by any .service files"
NOTE: Please ignore this error message if you are running your application in scratchbox
Warning: Qt GConf backend has got a NULL value for the key: "/system/osso/connectivity/IAP/last_used_network"
QMaemoInternetConnectivity has received an error message.
Name: "org.freedesktop.DBus.Error.ServiceUnknown"
Message: "The name com.nokia.icd_ui was not provided by any .service files"
NOTE: Please ignore this error message if you are running your application in scratchbox
QMaemoInternetConnectivity has received an error message.
Name: "org.freedesktop.DBus.Error.ServiceUnknown"
Message: "The name com.nokia.icd was not provided by any .service files"
NOTE: Please ignore this error message if you are running your application in scratchbox
Warning: Qt GConf backend has got a NULL value for the key: "/system/osso/connectivity/IAP/last_used_network"
QMaemoInternetConnectivity has received an error message.
Name: "org.freedesktop.DBus.Error.ServiceUnknown"
Message: "The name com.nokia.icd_ui was not provided by any .service files"
NOTE: Please ignore this error message if you are running your application in scratchbox
QMaemoInternetConnectivity has received an error message.
Name: "org.freedesktop.DBus.Error.ServiceUnknown"
Message: "The name com.nokia.icd was not provided by any .service files"
NOTE: Please ignore this error message if you are running your application in scratchbox
Warning: Qt GConf backend has got a NULL value for the key: "/system/osso/connectivity/IAP/last_used_network"
QMaemoInternetConnectivity has received an error message.
Name: "org.freedesktop.DBus.Error.ServiceUnknown"
Message: "The name com.nokia.icd_ui was not provided by any .service files"
NOTE: Please ignore this error message if you are running your application in scratchbox
[/QUOTE]
I don't know why i got the error highlighted by red color as no gdk object is used in my code.
Re: white screen when calling qwebview widget
[QUOTE=hulun499;732127]i got the below message when i run my example code
I don't know why i got the error highlighted by red color as no gdk object is used in my code.[/QUOTE]
Qt integrates with Gtk2 and it's using inside styles, certain methods and widgets from Gtk2 toolkit.
Re: white screen when calling qwebview widget
hi, all~i finally got the solution!
The reason why the qwebview cannot access webpage is the internet connectivity in the simulation environment of scratchbox. To solve the problem, you need 1)copy the /etc/resolv.conf to /scratchbox/etc/resolv.conf; 2)Change /scratchbox/etc/nsswitch.conf hosts-line as "hosts: files dns".
But actually i dunno much about the detail as i can use apt-get in the scratchbox which approves that the network connectivity is accessible there, i will appreciate if someone can explain it!
Thanks for the help of divanov and danhicksbyron!
Re: white screen when calling qwebview widget
You probably have network configured in /etc/apt/apt.conf
Which version of scratchbox are you using?
Are you behind firewall?
Re: white screen when calling qwebview widget
hi, Daniil~
[QUOTE=divanov;734782]You probably have network configured in /etc/apt/apt.conf[/QUOTE]
Do u mean the proxy setting in apt.conf? If so, my apt.conf doesn't have any such setting, you can see the content below.
[QUOTE]
// Don't open connections in parallel, that brings the little devices
// down to their knees.
//
Acquire::Queue-Mode "access";
Acquire::https::Verify-Peer "false";
APT::Install-Recommends 0;
[/QUOTE]
[QUOTE=divanov;734782]Which version of scratchbox are you using?[/QUOTE]
I'm using scratchbox 1 to do the development.
[QUOTE=divanov;734782]Are you behind firewall?[/QUOTE]
There should be a firewall as i'm in a company network.
Re: white screen when calling qwebview widget
[QUOTE=hulun499;734796]hi, Daniil~
Do u mean the proxy setting in apt.conf? If so, my apt.conf doesn't have any such setting, you can see the content below.[/QUOTE]
What are settings of your target? [I]sb-conf show[/I]
[QUOTE=hulun499;734796]I'm using scratchbox 1 to do the development.[/QUOTE]
This says particularly nothing to me. Are you using VirtualBox image for Windows or did you install rootstrap manually,
or did you use scratchbox installation script ([url]http://repository.maemo.org/stable/5.0/maemo-sdk-install_5.0.sh)?[/url]
[QUOTE=hulun499;734796]There should be a firewall as i'm in a company network.[/QUOTE]
Check if this page reports the same IP as you get with [I]ifconfig[/I]
[url]http://tools-on.net/privacy.shtml?o=who&t=566362706175&s=r[/url]