summaryrefslogtreecommitdiff
path: root/examples/widgets/tools
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-06-04 18:07:06 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-06-08 19:11:51 +0200
commita061a646429c6e9d695458fc0ecb0021a30e12ee (patch)
tree7ba6fce7ee7c8975b0c50e31195bd02c5419fc15 /examples/widgets/tools
parent24e52c10deedbaef833c0e2c3ee7bee03eacc4f5 (diff)
downloadqtbase-a061a646429c6e9d695458fc0ecb0021a30e12ee.tar.gz
Replace calls to deprecated QEvent accessor functions
Many of these were generated by clazy using the new qevent-accessors check. Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'examples/widgets/tools')
-rw-r--r--examples/widgets/tools/plugandpaint/app/paintarea.cpp12
-rw-r--r--examples/widgets/tools/undo/document.cpp12
2 files changed, 12 insertions, 12 deletions
diff --git a/examples/widgets/tools/plugandpaint/app/paintarea.cpp b/examples/widgets/tools/plugandpaint/app/paintarea.cpp
index 92b8ea4777..e3292e3b91 100644
--- a/examples/widgets/tools/plugandpaint/app/paintarea.cpp
+++ b/examples/widgets/tools/plugandpaint/app/paintarea.cpp
@@ -137,7 +137,7 @@ void PaintArea::mousePressEvent(QMouseEvent *event)
gradient.setColorAt(1.0, QColor(color.red(), color.green(),
color.blue(), 191));
painter.setBrush(gradient);
- painter.translate(event->pos() - boundingRect.center());
+ painter.translate(event->position().toPoint() - boundingRect.center());
painter.drawPath(pendingPath);
pendingPath = QPainterPath();
@@ -150,11 +150,11 @@ void PaintArea::mousePressEvent(QMouseEvent *event)
QPainter painter(&theImage);
setupPainter(painter);
const QRect rect = brushInterface->mousePress(brush, painter,
- event->pos());
+ event->position().toPoint());
update(rect);
}
- lastPos = event->pos();
+ lastPos = event->position().toPoint();
}
}
}
@@ -167,11 +167,11 @@ void PaintArea::mouseMoveEvent(QMouseEvent *event)
QPainter painter(&theImage);
setupPainter(painter);
const QRect rect = brushInterface->mouseMove(brush, painter, lastPos,
- event->pos());
+ event->position().toPoint());
update(rect);
}
- lastPos = event->pos();
+ lastPos = event->position().toPoint();
}
}
//! [1]
@@ -183,7 +183,7 @@ void PaintArea::mouseReleaseEvent(QMouseEvent *event)
QPainter painter(&theImage);
setupPainter(painter);
QRect rect = brushInterface->mouseRelease(brush, painter,
- event->pos());
+ event->position().toPoint());
update(rect);
}
diff --git a/examples/widgets/tools/undo/document.cpp b/examples/widgets/tools/undo/document.cpp
index 2deed83a99..339a63abae 100644
--- a/examples/widgets/tools/undo/document.cpp
+++ b/examples/widgets/tools/undo/document.cpp
@@ -283,17 +283,17 @@ int Document::indexAt(const QPoint &pos) const
void Document::mousePressEvent(QMouseEvent *event)
{
event->accept();
- int index = indexAt(event->pos());;
+ int index = indexAt(event->position().toPoint());;
if (index != -1) {
setCurrentShape(index);
const Shape &shape = m_shapeList.at(index);
- m_resizeHandlePressed = shape.resizeHandle().contains(event->pos());
+ m_resizeHandlePressed = shape.resizeHandle().contains(event->position().toPoint());
if (m_resizeHandlePressed)
- m_mousePressOffset = shape.rect().bottomRight() - event->pos();
+ m_mousePressOffset = shape.rect().bottomRight() - event->position().toPoint();
else
- m_mousePressOffset = event->pos() - shape.rect().topLeft();
+ m_mousePressOffset = event->position().toPoint() - shape.rect().topLeft();
}
m_mousePressIndex = index;
}
@@ -315,10 +315,10 @@ void Document::mouseMoveEvent(QMouseEvent *event)
QRect rect;
if (m_resizeHandlePressed) {
- rect = QRect(shape.rect().topLeft(), event->pos() + m_mousePressOffset);
+ rect = QRect(shape.rect().topLeft(), event->position().toPoint() + m_mousePressOffset);
} else {
rect = shape.rect();
- rect.moveTopLeft(event->pos() - m_mousePressOffset);
+ rect.moveTopLeft(event->position().toPoint() - m_mousePressOffset);
}
QSize size = rect.size().expandedTo(Shape::minSize);