summaryrefslogtreecommitdiffstats
path: root/examples/multitouch/fingerpaint
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-11 09:12:43 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-11 09:14:43 (GMT)
commit666299f9074235185aa7372729c84a2639224601 (patch)
tree2928f7299077d37211b78f2ae7a44e180d9e37cb /examples/multitouch/fingerpaint
parent1c6c353ecc23a01368d785794d130131e3fb2553 (diff)
downloadQt-666299f9074235185aa7372729c84a2639224601.zip
Qt-666299f9074235185aa7372729c84a2639224601.tar.gz
Qt-666299f9074235185aa7372729c84a2639224601.tar.bz2
another API review round: change Q*TouchEvent size() functions to return rects instead
these are more useful, as already shown in the fingerpaint example
Diffstat (limited to 'examples/multitouch/fingerpaint')
-rw-r--r--examples/multitouch/fingerpaint/scribblearea.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/examples/multitouch/fingerpaint/scribblearea.cpp b/examples/multitouch/fingerpaint/scribblearea.cpp
index ac7df08..c07d982 100644
--- a/examples/multitouch/fingerpaint/scribblearea.cpp
+++ b/examples/multitouch/fingerpaint/scribblearea.cpp
@@ -184,24 +184,21 @@ bool ScribbleArea::event(QEvent *event)
continue;
default:
{
- QSizeF size= touchPoint.size();
- if (size.isEmpty()) {
+ QRectF rect = touchPoint.rect();
+ if (rect.isEmpty()) {
qreal diameter = qreal(50) * touchPoint.pressure();
- size = QSizeF(diameter, diameter);
+ rect.setSize(QSizeF(diameter, diameter));
}
- QRectF rectF(QPointF(), size);
- rectF.moveCenter(touchPoint.pos());
- QRect rect = rectF.toRect();
QPainter painter(&image);
painter.setPen(Qt::NoPen);
painter.setBrush(myPenColors.at(touchPoint.id()));
- painter.drawEllipse(rectF);
+ painter.drawEllipse(rect);
painter.end();
modified = true;
int rad = 2;
- update(rect.adjusted(-rad,-rad, +rad, +rad));
+ update(rect.toRect().adjusted(-rad,-rad, +rad, +rad));
}
break;
}