summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets/tablet/tabletcanvas.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-05-03 15:13:01 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2017-05-08 17:49:18 +0000
commit5f2eee18c918ffb136fa2c491127f933e53345fe (patch)
tree30347fcdb3365c4e77cb1b859174eb79ca4406f8 /examples/widgets/widgets/tablet/tabletcanvas.cpp
parent3ea4f54db7351352146161a54e45f00ddaba8715 (diff)
tablet example: use stylus rotation property correctly
It was backwards from the expected value, consistently on iOS and xcb. It was already that way in 5.6, and we don't document which way is clockwise. So it seems to be just the example which is wrong. Change-Id: Ibbdadc2ae240017abc87439a2694fb5fbd3d07f8 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'examples/widgets/widgets/tablet/tabletcanvas.cpp')
-rw-r--r--examples/widgets/widgets/tablet/tabletcanvas.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp
index 54e8544a3d..9812c29554 100644
--- a/examples/widgets/widgets/tablet/tabletcanvas.cpp
+++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp
@@ -174,13 +174,13 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event)
painter.setBrush(m_brush);
QPolygonF poly;
qreal halfWidth = pressureToWidth(lastPoint.pressure);
- QPointF brushAdjust(qSin(qDegreesToRadians(lastPoint.rotation)) * halfWidth,
- qCos(qDegreesToRadians(lastPoint.rotation)) * halfWidth);
+ QPointF brushAdjust(qSin(qDegreesToRadians(-lastPoint.rotation)) * halfWidth,
+ qCos(qDegreesToRadians(-lastPoint.rotation)) * halfWidth);
poly << lastPoint.pos + brushAdjust;
poly << lastPoint.pos - brushAdjust;
halfWidth = m_pen.widthF();
- brushAdjust = QPointF(qSin(qDegreesToRadians(event->rotation())) * halfWidth,
- qCos(qDegreesToRadians(event->rotation())) * halfWidth);
+ brushAdjust = QPointF(qSin(qDegreesToRadians(-event->rotation())) * halfWidth,
+ qCos(qDegreesToRadians(-event->rotation())) * halfWidth);
poly << event->posF() - brushAdjust;
poly << event->posF() + brushAdjust;
painter.drawConvexPolygon(poly);
@@ -313,7 +313,7 @@ void TabletCanvas::updateCursor(const QTabletEvent *event)
QPainter painter(&img);
QTransform transform = painter.transform();
transform.translate(16, 16);
- transform.rotate(-event->rotation());
+ transform.rotate(event->rotation());
painter.setTransform(transform);
painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
painter.drawImage(-24, -24, origImg);