PDA

View Full Version : QWebView - browser example, 'alt' parameter on web page.



Tomasz
25th October 2010, 12:27
Hello!

I've downloaded "Fancybrowser" example from http://doc.qt.nokia.com/4.6/webkit-fancybrowser.html. It works just fine. But, can I use JavaScript or Flash with webkit? Do I need to turn it on/off somewhere?

Why I can't see the 'alt' on images while I'm browsing web pages? For example:
<area shape="rect" coords="0,0,10,100" href="javascript:void(null)" alt="alttext" title="alttext" />
I can't see that.

P.S. I can see 'alt' parameter on my PC but I'm using same browser on ARM, and on QT libs for ARM I can't see that.

thanks in advance
best regards
Tomasz

Brainsnail
25th October 2010, 13:03
You'll have to enable the usage of Plugins by invoking
QWebPage::settings()->setAttribute(QWebSettings::PluginsEnabled, true);

Tomasz
25th October 2010, 13:30
[...]/fancy_browser/mainwindow.cpp:63: error: cannot call member function ‘QWebSettings* QWebPage::settings() const’ without object


I've got only QWebView, so the code above doesn't work. Or maybe I'm doing something wrong.

thanks in advance
best regards
Tomasz

Brainsnail
25th October 2010, 14:07
The above line was just meant as a hint.
In my sources i've coded this:

Header:


QWebPage *m_page;
QWebSettings *m_settings;


Source:


m_page = new QWebPage(this);
m_settings = m_page->settings();
m_settings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
m_settings->setAttribute(QWebSettings::PluginsEnabled, true);


and this works fine in my app.

Tomasz
25th October 2010, 14:22
Ok. I've done it that way:



view = new QWebView(this);

QWebSettings *viewSettings;
viewSettings = view->settings();
viewSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
viewSettings->setAttribute(QWebSettings::PluginsEnabled, true);


But when start my app I get something like that:


QWebInspector: QSettings couldn't read configuration setting [resourceTrackingEnabled].


But program still works, and I still don't have 'alt' parameter working. Any ideas?

thanks in advance
best regards
Tomasz