[webkit-qt] QML integration question

Harri Pasanen grego at mpaja.com
Fri Nov 11 14:02:03 PST 2011


Ok, I've been bumping my head against the wall a few hours trying to make my 
own instance of QDeclarativeWebView to work.

Basically I tried the same approach as Felipe, copying qdeclarativewebview_p.h 
and qdeclarativewebview.cpp into my project.

I'm a bit worried about name clashes, as I don't know how moc comes into 
equation here, is there a risk that at runtime some qml lookup would find some 
symbol/object from shared library, instead of the one in my binary?

Something odd is happening, as when I do in main.cpp

  #include "qdeclarativewebview_p.h"

and then

  qmlRegisterType<QDeclarativeWebView>("MyWebKit", 1, 0, "WebView");

I can replace 

  import QtWebKit 1.0 

with 

  import MyWebKit 1.0

and everything works fine on desktop.

On N9 phone however, MyWebKit version stops rendering.
If I add some debug statements to qdeclarativewebview.cpp I see that it is 
being called on phone as well and seems to be working just like on desktop, 
except that nothing is rendered.

If I do a minimal QML that just shows the webview, MyWebKit version, that 
works on the phone, but as soon as stuff is added around it stops rendering, 
which would indicate the object tree somehow gets messed up.

Any educated guesses on what is going in are welcome.

Just to rule out anything cross I threw valgrind at it, which on desktop spat 
out the following.  I'm not seeing anything overly suspicious in here though, 
unless the qt_metacall stuff is it.

==7384== Conditional jump or move depends on uninitialised value(s)
==7384==    at 0xAFA9510: inflateReset2 (in /lib/x86_64-linux-
gnu/libz.so.1.2.3.4)
==7384==    by 0xAFA9605: inflateInit2_ (in /lib/x86_64-linux-
gnu/libz.so.1.2.3.4)
==7384==    by 0xBC081C0: png_create_read_struct_2 (in /lib/x86_64-linux-
gnu/libpng12.so.0.44.0)
==7384==    by 0xBC08366: png_create_read_struct (in /lib/x86_64-linux-
gnu/libpng12.so.0.44.0)
==7384==    by 0x6EFD29E: ??? (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4.7.4)
==7384==    by 0x6EFDBAD: ??? (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4.7.4)
==7384==    by 0x6EFEBDB: ??? (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4.7.4)
==7384==    by 0x6EC9DFD: QImageReader::read(QImage*) (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4.7.4)
==7384==    by 0x6ECA36B: QImageReader::read() (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4.7.4)
==7384==    by 0x6EBC9C2: QImage::load(QString const&, char const*) (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4.7.4)
==7384==    by 0x6EBCC25: QImage::QImage(QString const&, char const*) (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4.7.4)
==7384==    by 0x13E54596: MLocalThemeDaemonClient::readImage(QString const&) 
const (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/imports/com/nokia/meego/libmeegoplugin.so)
==7384== 
==7384== Conditional jump or move depends on uninitialised value(s)
==7384==    at 0x13E49BB5: 
MDeclarativeStatusBar::updateXdamageEventSubscription() (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/imports/com/nokia/meego/libmeegoplugin.so)
==7384==    by 0x13E7435F: 
MDeclarativeStatusBar::qt_metacall(QMetaObject::Call, int, void**) (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/imports/com/nokia/meego/libmeegoplugin.so)
==7384==    by 0x5011D1D: ??? (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtDeclarative.so.4.7.4)
==7384==    by 0x7B20F87: QMetaObject::activate(QObject*, QMetaObject const*, 
int, void**) (in /home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtCore.so.4.7.4)
==7384==    by 0x13E53B10: 
MWindowStatePrivate::handleXFocusChangeEvent(XFocusChangeEvent*) (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/imports/com/nokia/meego/libmeegoplugin.so)
==7384==    by 0x13E53C59: MWindowStatePrivate::eventFilter(void*, long*) (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/imports/com/nokia/meego/libmeegoplugin.so)
==7384==    by 0x7B0ABDC: QCoreApplication::filterEvent(void*, long*) (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtCore.so.4.7.4)
==7384==    by 0x6E6B164: ??? (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4.7.4)
==7384==    by 0x6E790CE: QApplication::x11ProcessEvent(_XEvent*) (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4.7.4)
==7384==    by 0x6EA5077: ??? (in 
/home/harri/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so.4.7.4)
==7384==    by 0xB94ABCC: g_main_context_dispatch (in /lib/x86_64-linux-
gnu/libglib-2.0.so.0.2800.6)
==7384==    by 0xB94B3A7: ??? (in /lib/x86_64-linux-
gnu/libglib-2.0.so.0.2800.6)



On Thursday, November 03, 2011 09:20:20 AM Alexis Menard wrote:
> Hi,
> 
> On Thu, Nov 3, 2011 at 4:58 AM, Harri Pasanen <grego at mpaja.com> wrote:
> > I'm making my first steps in QML, looking at QML Web View element.
> > 
> > If I'd like to get access to functionality under the hood to extend what
> > QML Web View does, how would I go about it?
> 
> You in fact can't.
> 
> > For instance, I'd like to intercept linkClicked signal that QWebView
> > sends, but QML Web View does not expose.
> 
> One way could be to extend QDeclarativeWebView but it's a private
> class (exported). QDeclarativeWebView is just a wrapper on top of
> QGraphicsWebView not QWebView.
> 
> You can see if you prefer to subclass QGraphicsWebView and expose it in
> QML.
> 
> The WebView element in QtWebKit 1.0 was not developed further as we
> move to WebKit2/Qt5 where in that world the QML api will be the
> primary entry point.
> 
> > Is there a way to subclass in C++ what ever class QML uses underneath to
> > implement a better QML Web View element?
> 
> See previous.
> 
> > I'd appreciate any pointers to either documentation or source code.
> > 
> > Or should at ask at qt-qml mailing list?
> > 
> > Thanks,
> > 
> > Harri
> > 
> > 
> > _______________________________________________
> > webkit-qt mailing list
> > webkit-qt at lists.webkit.org
> > http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20111111/c4e6111b/attachment-0001.html>


More information about the webkit-qt mailing list