From f31240c216e19fe02547f078608fa8c0a2aaca7d Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Mon, 22 Jun 2009 14:05:06 +0200 Subject: 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. --- examples/multitouch/fingerpaint/scribblearea.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); -- cgit v0.12