From b828a0efd42e40470be0cf069a14017f3c848026 Mon Sep 17 00:00:00 2001 From: William Viana Soares Date: Sun, 13 Jul 2008 20:50:53 +0000 Subject: [PATCH] Repaint the widget on request. Among other things now the scroll works well. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=832013 --- widgets/webcontent.cpp | 10 ++++++++++ widgets/webcontent.h | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/widgets/webcontent.cpp b/widgets/webcontent.cpp index 37dd2a88c..0791d3a05 100644 --- a/widgets/webcontent.cpp +++ b/widgets/webcontent.cpp @@ -43,6 +43,7 @@ public: } void loadingFinished(bool success); + void updateRequested(const QRect& dirtyRect); WebContent *q; QWebPage *page; @@ -111,6 +112,7 @@ void WebContent::setPage(QWebPage *page) if (d->page) { connect(d->page, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); connect(d->page, SIGNAL(loadFinished(bool)), this, SLOT(loadingFinished(bool))); + connect(d->page, SIGNAL(repaintRequested(const QRect&)), this, SLOT(updateRequested(const QRect&))); } } @@ -349,6 +351,14 @@ void WebContentPrivate::loadingFinished(bool success) { loaded = success; emit q->loadFinished(success); + q->update(); +} + +void WebContentPrivate::updateRequested(const QRect& dirtyRect) +{ + if (loaded && page) { + q->update(QRectF(dirtyRect.topLeft().x(), dirtyRect.topLeft().y(), dirtyRect.width(), dirtyRect.height())); + } } } // namespace Plasma diff --git a/widgets/webcontent.h b/widgets/webcontent.h index 33861ed0e..943b16c3c 100644 --- a/widgets/webcontent.h +++ b/widgets/webcontent.h @@ -30,6 +30,7 @@ class QKeyEvent; class QGraphicsSceneDragDropEvent; class QGraphicsSceneMouseEvent; class QGraphicsSceneWheelEvent; +class QRect; namespace Plasma { @@ -97,7 +98,7 @@ class PLASMA_EXPORT WebContent : public QGraphicsWidget /** * Reimplementation */ - void setGeometry(const QRectF &geometry); + void setGeometry(const QRectF &geometry); Q_SIGNALS: /** @@ -138,6 +139,7 @@ class PLASMA_EXPORT WebContent : public QGraphicsWidget private: Q_PRIVATE_SLOT(d, void loadingFinished(bool success)) + Q_PRIVATE_SLOT(d, void updateRequested(const QRect& dirtyRect)) WebContentPrivate * const d; friend class WebContentPrivate;