I tried this approach and indeed it was very straight forward. I just refactored QDeclarativeWebView to my own and registered the type.
I needed to intercept the linkClicked(QUrl) signal and that worked fine for the desktop. However, for some reason on harmattan N9 device my own webview does not render, everything is black. I went back so that only change I did was renaming the QDeclarativeWebView, but even then it does not render other than black. Any idea what might cause this? The source files I used were from QtSDK: QtSDK/QtSources/4.7.4/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview_p.h QtSDK/QtSources/4.7.4/src/3rdparty/webkit/WebKit/qt/declarative/qdeclarativewebview.cpp Changing the import in qml makes it work/not work. Between the two runs I don't see any difference in Application Output pane, just usual: Remote process started. Using the meego graphics system loaded the Generic plugin loaded the grue plugin Loaded the MeeGo sensor plugin Setting data rate 0 Hz (interval 0 ms) for "meego.orientationsensor" Setting data rate 0 Hz (interval 0 ms) for "meego.orientationsensor" Found SGX/MBX driver, enabling FullClearOnEveryFrame Found v1.4 driver, enabling brokenTexSubImage Successfully resolved MeeGo graphics system: /usr/lib/qt4/plugins/graphicssystems/libqmeegographicssystem.so MeegoGraphics: found EGL_NOK_image_shared MeegoGraphics: found EGL_KHR_lock_surface2 MeegoGraphics: found EGL_KHR_fence_sync X Error: BadDamage (invalid Damage parameter) 153 Extension: 146 (Uknown extension) Minor opcode: 2 (Unknown request) Resource id: 0x29 hijackWindow() context created for QDeclarativeView(0x1f5e16c0) 1 Found SGX/MBX driver, enabling FullClearOnEveryFrame Found v1.4 driver, enabling brokenTexSubImage QGLWindowSurface: Using plain widget as window surface QGLWindowSurface(0x1f7d6a48) Found EGL_KHR_image_pixmap & GL_OES_EGL_image extensions (preferred method)! Found texture_from_pixmap EGL extension! Confused... /Harri On Thursday, November 03, 2011 01:06:32 PM Felipe Crochik wrote: > I have created a new webview qml element from scratch but on one of my many > (failed) attempts to find out why my application crashes on harmattan I > also tried copying the qdeclarativewebview.cpp and qdeclarativewebview_p.h > from the Qt sources and making a few modifications. > > It was surprisingly uneventful and it worked just fine (I just registered > on my c++ code the type and could swap between "implementations" by just > changing the import statement on my qml). > > Most likely you will have to modify the "private" parts of the > implementation so you won't be able to "just" extend the class and with > future qt releases you will have to manually merge your changes. > > Felipe > > On Thu, Nov 3, 2011 at 4:20 AM, Alexis Menard > > <[email protected]>wrote: > > Hi, > > > > On Thu, Nov 3, 2011 at 4:58 AM, Harri Pasanen <[email protected]> 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 > > > [email protected] > > > http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt > > > > -- > > Alexis Menard (darktears) > > Software Engineer > > INdT Recife Brazil > > _______________________________________________ > > webkit-qt mailing list > > [email protected] > > http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
_______________________________________________ webkit-qt mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
