fingerpaint example: Use the maximum diameter for the touch spot by default
The result doesn't look good when you paint with the MinimumDiameter (3 px). Also don't paint released touch points, because we can't get neither the touch rect not the pressure for them. Change-Id: I8d17c4884ae41545b2cd3f208afa73262133456c Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
parent
0c85cdb8c2
commit
431e5d9f47
@ -187,13 +187,14 @@ bool ScribbleArea::event(QEvent *event)
|
||||
foreach (const QTouchEvent::TouchPoint &touchPoint, touchPoints) {
|
||||
switch (touchPoint.state()) {
|
||||
case Qt::TouchPointStationary:
|
||||
// don't do anything if this touch point hasn't moved
|
||||
case Qt::TouchPointReleased:
|
||||
// don't do anything if this touch point hasn't moved or has been released
|
||||
continue;
|
||||
default:
|
||||
{
|
||||
QRectF rect = touchPoint.rect();
|
||||
if (rect.isEmpty()) {
|
||||
qreal diameter = MinimumDiameter;
|
||||
qreal diameter = MaximumDiameter;
|
||||
if (touch->device()->capabilities() & QTouchDevice::Pressure)
|
||||
diameter = MinimumDiameter + (MaximumDiameter - MinimumDiameter) * touchPoint.pressure();
|
||||
rect.setSize(QSizeF(diameter, diameter));
|
||||
|
Loading…
Reference in New Issue
Block a user