diff --git a/widgets/webview.cpp b/widgets/webview.cpp index 5a5642e9f..0a09dfe1e 100644 --- a/widgets/webview.cpp +++ b/widgets/webview.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -35,9 +36,9 @@ #include #include -#include "plasma/widgets/webview.h" - -#include "plasma/animator.h" +#include "animator.h" +#include "plasma.h" +#include "widgets/webview.h" namespace Plasma { @@ -201,6 +202,10 @@ void WebView::setPage(QWebPage *page) } d->page = page; + //FIXME: QWebPage _requires_ a QWidget view to not crash in places such as + // WebCore::PopupMenu::show() due to hostWindow()->platformPageClient() == NULL + // because QWebPage::d->client is NULL + d->page->setView(viewFor(this)); if (d->page) { connect(d->page, SIGNAL(loadProgress(int)), @@ -290,6 +295,7 @@ void WebView::mousePressEvent(QGraphicsSceneMouseEvent *event) QMouseEvent me(QEvent::MouseButtonPress, event->pos().toPoint(), event->button(), event->buttons(), event->modifiers()); +// d->page->event(event); d->page->event(&me); if (me.isAccepted() && !d->dragToScroll) { event->accept(); @@ -477,6 +483,18 @@ void WebView::dropEvent(QGraphicsSceneDragDropEvent * event) } } +QVariant WebView::itemChange(GraphicsItemChange change, const QVariant &value) +{ + if (change == QGraphicsItem::ItemSceneHasChanged && d->page) { + //FIXME: QWebPage _requires_ a QWidget view to not crash in places such as + // WebCore::PopupMenu::show() due to hostWindow()->platformPageClient() == NULL + // because QWebPage::d->client is NULL + d->page->setView(viewFor(this)); + } + + return QGraphicsWidget::itemChange(change, value); +} + void WebView::setGeometry(const QRectF &geometry) { QGraphicsWidget::setGeometry(geometry); diff --git a/widgets/webview.h b/widgets/webview.h index 45baff8f1..cb59e9647 100644 --- a/widgets/webview.h +++ b/widgets/webview.h @@ -211,6 +211,7 @@ class PLASMA_EXPORT WebView : public QGraphicsWidget void dragLeaveEvent(QGraphicsSceneDragDropEvent * event); void dragMoveEvent(QGraphicsSceneDragDropEvent * event); void dropEvent(QGraphicsSceneDragDropEvent * event); + QVariant itemChange(GraphicsItemChange change, const QVariant &value); QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const; private: