summaryrefslogtreecommitdiffstats
path: root/examples/multitouch
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-05 15:36:18 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-05 15:36:18 (GMT)
commit66f1080dc931ea024014ab3153ef7b99039540d2 (patch)
tree4ff5c8fbc3ecaf508635fb915fbe7ec33e61646d /examples/multitouch
parent8d8b3e03cfc36c72665494eaa9bb461ff18072a0 (diff)
downloadQt-66f1080dc931ea024014ab3153ef7b99039540d2.zip
Qt-66f1080dc931ea024014ab3153ef7b99039540d2.tar.gz
Qt-66f1080dc931ea024014ab3153ef7b99039540d2.tar.bz2
Compile after API updates
Diffstat (limited to 'examples/multitouch')
-rw-r--r--examples/multitouch/fingerpaint/scribblearea.cpp20
-rw-r--r--examples/multitouch/knobs/knob.cpp8
-rw-r--r--examples/multitouch/pinchzoom/graphicsview.cpp14
3 files changed, 21 insertions, 21 deletions
diff --git a/examples/multitouch/fingerpaint/scribblearea.cpp b/examples/multitouch/fingerpaint/scribblearea.cpp
index 71fbd19..ac7df08 100644
--- a/examples/multitouch/fingerpaint/scribblearea.cpp
+++ b/examples/multitouch/fingerpaint/scribblearea.cpp
@@ -176,26 +176,26 @@ bool ScribbleArea::event(QEvent *event)
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
{
- QList<QTouchEvent::TouchPoint *> touchPoints = static_cast<QTouchEvent *>(event)->touchPoints();
- foreach (QTouchEvent::TouchPoint *touchPoint, touchPoints) {
- switch (touchPoint->state()) {
+ QList<QTouchEvent::TouchPoint> touchPoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ foreach (const QTouchEvent::TouchPoint &touchPoint, touchPoints) {
+ switch (touchPoint.state()) {
case Qt::TouchPointStationary:
// don't do anything if this touch point hasn't moved
continue;
default:
{
- QSizeF area = touchPoint->area();
- if (area.isEmpty()) {
- qreal diameter = qreal(50) * touchPoint->pressure();
- area = QSizeF(diameter, diameter);
+ QSizeF size= touchPoint.size();
+ if (size.isEmpty()) {
+ qreal diameter = qreal(50) * touchPoint.pressure();
+ size = QSizeF(diameter, diameter);
}
- QRectF rectF(QPointF(), area);
- rectF.moveCenter(touchPoint->pos());
+ 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.setBrush(myPenColors.at(touchPoint.id()));
painter.drawEllipse(rectF);
painter.end();
diff --git a/examples/multitouch/knobs/knob.cpp b/examples/multitouch/knobs/knob.cpp
index bced73c..d568167 100644
--- a/examples/multitouch/knobs/knob.cpp
+++ b/examples/multitouch/knobs/knob.cpp
@@ -69,11 +69,11 @@ bool Knob::sceneEvent(QEvent *event)
QGraphicsSceneTouchEvent *touchEvent = static_cast<QGraphicsSceneTouchEvent *>(event);
if (touchEvent->touchPoints().count() == 2) {
- QGraphicsSceneTouchEvent::TouchPoint *touchPoint1 = touchEvent->touchPoints().first();
- QGraphicsSceneTouchEvent::TouchPoint *touchPoint2 = touchEvent->touchPoints().last();
+ const QGraphicsSceneTouchEvent::TouchPoint &touchPoint1 = touchEvent->touchPoints().first();
+ const QGraphicsSceneTouchEvent::TouchPoint &touchPoint2 = touchEvent->touchPoints().last();
- QLineF line1(touchPoint1->lastScenePos(), touchPoint2->lastScenePos());
- QLineF line2(touchPoint1->scenePos(), touchPoint2->scenePos());
+ QLineF line1(touchPoint1.lastScenePos(), touchPoint2.lastScenePos());
+ QLineF line2(touchPoint1.scenePos(), touchPoint2.scenePos());
rotate(line2.angleTo(line1));
}
diff --git a/examples/multitouch/pinchzoom/graphicsview.cpp b/examples/multitouch/pinchzoom/graphicsview.cpp
index 0856639..b72da77 100644
--- a/examples/multitouch/pinchzoom/graphicsview.cpp
+++ b/examples/multitouch/pinchzoom/graphicsview.cpp
@@ -57,18 +57,18 @@ bool GraphicsView::event(QEvent *event)
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
{
- QList<QTouchEvent::TouchPoint *> touchPoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ QList<QTouchEvent::TouchPoint> touchPoints = static_cast<QTouchEvent *>(event)->touchPoints();
if (touchPoints.count() == 1) {
- const QTouchEvent::TouchPoint *touchPoint = touchPoints.first();
- QPointF delta = touchPoint->pos() - touchPoint->lastPos();
+ const QTouchEvent::TouchPoint &touchPoint = touchPoints.first();
+ QPointF delta = touchPoint.pos() - touchPoint.lastPos();
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - delta.x());
verticalScrollBar()->setValue(verticalScrollBar()->value() - delta.y());
} else if (touchPoints.count() == 2) {
// determine scale factor
- const QTouchEvent::TouchPoint *touchPoint0 = touchPoints.first();
- const QTouchEvent::TouchPoint *touchPoint1 = touchPoints.last();
- const qreal scaleFactor = QLineF(touchPoint0->pos(), touchPoint1->pos()).length()
- / QLineF(touchPoint0->startPos(), touchPoint1->startPos()).length();
+ const QTouchEvent::TouchPoint &touchPoint0 = touchPoints.first();
+ const QTouchEvent::TouchPoint &touchPoint1 = touchPoints.last();
+ const qreal scaleFactor = QLineF(touchPoint0.pos(), touchPoint1.pos()).length()
+ / QLineF(touchPoint0.startPos(), touchPoint1.startPos()).length();
setTransform(QTransform().scale(scaleFactor, scaleFactor));
}
return true;