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>bb10
parent
3ea4f54db7
commit
5f2eee18c9
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue