Search code examples
c++qt4qmlqtwebkitqwebview

access QWebPage object from WebView QML element


Is there a way to access the QWebPage object from WebView's underlying QWebView object?

QWebView has:

QWebPage * QWebView::page () const

src: http://doc.qt.nokia.com/4.7-snapshot/qwebview.html#page

However it doesn't seem to be exposed in QML


Solution

  • I haven't tryed it, but ...

    In qdeclarativewebview_p.h at line 59 there is defined as public:

    159  QWebPage *page() const;
    160  void setPage(QWebPage *page);
    

    So you should be able to access this at least from C++ (but not directly from QML).

    If you need it in QML, you can inherit the original QDeclarativeWebView and expose this property for access in QML.