summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-04-11 01:00:13 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-04-11 14:59:13 +0200
commit58a42898006f221807a08557f588a2d973a7ada2 (patch)
tree62d92617eae5df5aae666ea0902159498b285b24 /examples/widgets
parent033d01bd6e2aef740ad1408a04d3ca0ae3b9ba9b (diff)
parent1ec350e35fcea87c527b36cf429b595731059240 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: tests/auto/network/socket/platformsocketengine/platformsocketengine.pri Change-Id: I22daf269a8f28f80630b5f521b91637531156404
Diffstat (limited to 'examples/widgets')
-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;