summaryrefslogtreecommitdiffstats
path: root/examples/widgets/touch
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-04-10 12:55:43 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-04-10 13:54:43 +0000
commit1ec350e35fcea87c527b36cf429b595731059240 (patch)
tree2a9d94116f747f7070921bf1fb82e5b145de0db7 /examples/widgets/touch
parent9de8313b0b432cae48ef47a73eba1e465ae0d8fc (diff)
Stop using obsolete TouchPoint rect accessors in tests and examples
Followup to cf4a8b12fa277c2ea218f022607934f60fed1a06 68916fede41d1eca5d07eb6b1db518d41a007616 and 3c159957f863cf8d367a9261e7016e52cd0348c1. Task-number: QTBUG-83403 Change-Id: Ieaf418860c565dbe883384e7f296a829fbfa1e33 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'examples/widgets/touch')
-rw-r--r--examples/widgets/touch/fingerpaint/scribblearea.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/widgets/touch/fingerpaint/scribblearea.cpp b/examples/widgets/touch/fingerpaint/scribblearea.cpp
index e490495cd9..4af0ec8e7e 100644
--- a/examples/widgets/touch/fingerpaint/scribblearea.cpp
+++ b/examples/widgets/touch/fingerpaint/scribblearea.cpp
@@ -205,22 +205,24 @@ bool ScribbleArea::event(QEvent *event)
continue;
default:
{
- QRectF rect = touchPoint.rect();
- if (rect.isEmpty()) {
+ QSizeF diams = touchPoint.ellipseDiameters();
+ if (diams.isEmpty()) {
qreal diameter = MaximumDiameter;
if (touch->device()->capabilities() & QTouchDevice::Pressure)
diameter = MinimumDiameter + (MaximumDiameter - MinimumDiameter) * touchPoint.pressure();
- rect.setSize(QSizeF(diameter, diameter));
+ diams = QSizeF(diameter, diameter);
}
QPainter painter(&image);
painter.setPen(Qt::NoPen);
painter.setBrush(myPenColors.at(touchPoint.id() % myPenColors.count()));
- painter.drawEllipse(rect);
+ painter.drawEllipse(touchPoint.pos(), diams.width() / 2, diams.height() / 2);
painter.end();
modified = true;
- int rad = 2;
+ const int rad = 2;
+ QRectF rect(QPointF(), diams);
+ rect.moveCenter(touchPoint.pos());
update(rect.toRect().adjusted(-rad,-rad, +rad, +rad));
}
break;