diff options
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp | 122 |
1 files changed, 32 insertions, 90 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp index 0cb4204..50a0986 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.cpp @@ -164,101 +164,17 @@ void QGraphicsWebViewPrivate::_q_setStatusBarMessage(const QString& s) /*! \class QGraphicsWebView - \brief The QGraphicsWebView class allows Web content to be added to a GraphicsView. + \brief The QGraphicsWebView class allows web content to be added to a GraphicsView. \since 4.6 - An instance of this class renders Web content from a URL or supplied as data, using - features of the QtWebKit module. + A WebGraphicsItem renders web content based on a URL or set data. - If the width and height of the item is not set, they will dynamically adjust to - a size appropriate for the content. This width may be large (e.g., 980 pixels or - more) for typical online Web pages. - - \section1 Browser Features - - Many of the functions, signals and properties provided by QWebView are also available - for this item, making it simple to adapt existing code to use QGraphicsWebView instead - of QWebView. - - The item uses a QWebPage object to perform the rendering of Web content, and this can - be obtained with the page() function, enabling the document itself to be accessed and - modified. - - As with QWebView, the item records the browsing history using a QWebHistory object, - accessible using the history() function. The QWebSettings object that defines the - configuration of the browser can be obtained with the settings() function, enabling - features like plugin support to be customized for each item. - - \sa QWebView, QGraphicsTextItem -*/ - -/*! - \fn void QGraphicsWebView::titleChanged(const QString &title) - - This signal is emitted whenever the \a title of the main frame changes. - - \sa title() + If the width and height of the item is not set, they will + dynamically adjust to a size appropriate for the content. + This width may be large (eg. 980) for typical online web pages. */ /*! - \fn void QGraphicsWebView::urlChanged(const QUrl &url) - - This signal is emitted when the \a url of the view changes. - - \sa url(), load() -*/ - -/*! - \fn void QGraphicsWebView::statusChanged() - - This signal is emitted when the status bar text is changed by the page. -*/ - -/*! - \fn void QGraphicsWebView::iconChanged() - - This signal is emitted whenever the icon of the page is loaded or changes. - - In order for icons to be loaded, you will need to set an icon database path - using QWebSettings::setIconDatabasePath(). - - \sa icon(), QWebSettings::setIconDatabasePath() -*/ - -/*! - \fn void QGraphicsWebView::loadStarted() - - This signal is emitted when a new load of the page is started. - - \sa progressChanged(), loadFinished() -*/ - -/*! - \fn void QGraphicsWebView::loadFinished(bool ok) - - This signal is emitted when a load of the page is finished. - \a ok will indicate whether the load was successful or any error occurred. - - \sa loadStarted() -*/ - -/*! - \fn void QGraphicsWebView::progressChanged(qreal progress) - - This signal is emitted every time an element in the web page - completes loading and the overall loading progress advances. - - This signal tracks the progress of all child frames. - - The current value is provided by \a progress and scales from 0.0 to 1.0, - which is the default range of QProgressBar. - - \sa loadStarted(), loadFinished() -*/ - - - -/*! Constructs an empty QGraphicsWebView with parent \a parent. \sa load() @@ -275,12 +191,16 @@ QGraphicsWebView::QGraphicsWebView(QGraphicsItem* parent) } /*! - Destroys the item. + Destroys the web graphicsitem. */ QGraphicsWebView::~QGraphicsWebView() { if (d->page) { +#if QT_VERSION >= 0x040600 + d->page->d->view.clear(); +#else d->page->d->view = 0; +#endif d->page->d->client = 0; // unset the page client } @@ -330,6 +250,28 @@ bool QGraphicsWebView::sceneEvent(QEvent* event) /*! \reimp */ +QVariant QGraphicsWebView::itemChange(GraphicsItemChange change, const QVariant& value) +{ + switch (change) { + // Differently from QWebView, it is interesting to QGraphicsWebView to handle + // post mouse cursor change notifications. Reason: 'ItemCursorChange' is sent + // as the first action in QGraphicsItem::setCursor implementation, and at that + // item widget's cursor has not been effectively changed yet. + // After cursor is properly set (at 'ItemCursorHasChanged' emission time), we + // fire 'CursorChange'. + case ItemCursorChange: + return value; + case ItemCursorHasChanged: + QEvent event(QEvent::CursorChange); + QApplication::sendEvent(this, &event); + return value; + } + + return QGraphicsWidget::itemChange(change, value); +} + +/*! \reimp +*/ bool QGraphicsWebView::event(QEvent* event) { // Re-implemented in order to allows fixing event-related bugs in patch releases. |