summaryrefslogtreecommitdiff
path: root/libsowatch/graphicswatchlet.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-09-26 02:36:09 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-09-26 02:36:09 +0200
commit0822b88738e00625efd27ccca9119885272924d2 (patch)
treef379817602cc23dd829c0aa4751b6b5edc348923 /libsowatch/graphicswatchlet.cpp
parentcf5d24b94d96b722c6d76c2225293a56a50d3c2b (diff)
downloadsowatch-0822b88738e00625efd27ccca9119885272924d2.tar.gz
sowatch-0822b88738e00625efd27ccca9119885272924d2.zip
fixing bugs found during use ;)
Diffstat (limited to 'libsowatch/graphicswatchlet.cpp')
-rw-r--r--libsowatch/graphicswatchlet.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/libsowatch/graphicswatchlet.cpp b/libsowatch/graphicswatchlet.cpp
index 538723a..195d11b 100644
--- a/libsowatch/graphicswatchlet.cpp
+++ b/libsowatch/graphicswatchlet.cpp
@@ -1,4 +1,5 @@
#include <QtCore/QDebug>
+#include <QtCore/QEvent>
#include <QtGui/QPainter>
#include "watch.h"
@@ -30,18 +31,25 @@ void GraphicsWatchlet::setScene(QGraphicsScene *scene)
void GraphicsWatchlet::sceneChanged(const QList<QRectF> &region)
{
- foreach(const QRectF& r, region)
- {
+ foreach(const QRectF& r, region) {
_damaged += r.toRect();
}
-
if (!_damaged.isEmpty() && _active && !watch()->busy()) {
const QVector<QRect> rects = _damaged.rects();
QPainter p(watch());
- foreach(const QRect& r, rects)
- {
+
+ foreach(const QRect& r, rects) {
_scene->render(&p, r, r, Qt::IgnoreAspectRatio);
}
_damaged = QRegion();
}
}
+
+void GraphicsWatchlet::activate()
+{
+ Watchlet::activate();
+ // We have to assume that the watch has completely forgot about everything.
+ QRect area(0, 0, watch()->width(), watch()->height());
+ _damaged += area;
+ _scene->update(area);
+}