Repaint the widget on request. Among other things now the scroll works well.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=832013
This commit is contained in:
William Viana Soares 2008-07-13 20:50:53 +00:00
parent a1ff7b38f4
commit b828a0efd4
2 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -30,6 +30,7 @@ class QKeyEvent;
class QGraphicsSceneDragDropEvent;
class QGraphicsSceneMouseEvent;
class QGraphicsSceneWheelEvent;
class QRect;
namespace Plasma
{
@ -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;