summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-22 12:05:06 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-22 12:05:06 (GMT)
commitf31240c216e19fe02547f078608fa8c0a2aaca7d (patch)
treeb4e2892db50e933107a802231deb758ca4edd62b
parentc46031639094f41d7b345dcab1c02eda283e9fdd (diff)
downloadQt-f31240c216e19fe02547f078608fa8c0a2aaca7d.zip
Qt-f31240c216e19fe02547f078608fa8c0a2aaca7d.tar.gz
Qt-f31240c216e19fe02547f078608fa8c0a2aaca7d.tar.bz2
Don't crash in the fingerpaint example if the touch id gets too large
Some touch devices don't recycle touch id's, so for longer sequences we could easily see ids that become larger than the color list size. Make sure we constrain the index we use.
-rw-r--r--examples/multitouch/fingerpaint/scribblearea.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/multitouch/fingerpaint/scribblearea.cpp b/examples/multitouch/fingerpaint/scribblearea.cpp
index c07d982..0e828cc 100644
--- a/examples/multitouch/fingerpaint/scribblearea.cpp
+++ b/examples/multitouch/fingerpaint/scribblearea.cpp
@@ -192,7 +192,7 @@ bool ScribbleArea::event(QEvent *event)
QPainter painter(&image);
painter.setPen(Qt::NoPen);
- painter.setBrush(myPenColors.at(touchPoint.id()));
+ painter.setBrush(myPenColors.at(touchPoint.id() % myPenColors.count()));
painter.drawEllipse(rect);
painter.end();