summaryrefslogtreecommitdiffstats
path: root/examples/widgets/painting
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/painting
parent24e52c10deedbaef833c0e2c3ee7bee03eacc4f5 (diff)
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/painting')
-rw-r--r--examples/widgets/painting/deform/pathdeform.cpp12
-rw-r--r--examples/widgets/painting/pathstroke/pathstroke.cpp16
-rw-r--r--examples/widgets/painting/shared/hoverpoints.cpp12
3 files changed, 20 insertions, 20 deletions
diff --git a/examples/widgets/painting/deform/pathdeform.cpp b/examples/widgets/painting/deform/pathdeform.cpp
index 961d5e5e99..9ddc6ea12b 100644
--- a/examples/widgets/painting/deform/pathdeform.cpp
+++ b/examples/widgets/painting/deform/pathdeform.cpp
@@ -490,10 +490,10 @@ void PathDeformRenderer::mousePressEvent(QMouseEvent *e)
m_repaintTimer.stop();
m_offset = QPointF();
- if (QLineF(m_pos, e->pos()).length() <= m_radius)
- m_offset = m_pos - e->pos();
+ if (QLineF(m_pos, e->position().toPoint()).length() <= m_radius)
+ m_offset = m_pos - e->position().toPoint();
- m_mousePress = e->pos();
+ m_mousePress = e->position().toPoint();
// If we're not running in small screen mode, always assume we're dragging
m_mouseDrag = !m_smallScreen;
@@ -514,18 +514,18 @@ void PathDeformRenderer::mouseReleaseEvent(QMouseEvent *e)
void PathDeformRenderer::mouseMoveEvent(QMouseEvent *e)
{
- if (!m_mouseDrag && (QLineF(m_mousePress, e->pos()).length() > 25.0) )
+ if (!m_mouseDrag && (QLineF(m_mousePress, e->position().toPoint()).length() > 25.0) )
m_mouseDrag = true;
if (m_mouseDrag) {
QRect rectBefore = circle_bounds(m_pos, m_radius, m_fontSize);
if (e->type() == QEvent::MouseMove) {
- QLineF line(m_pos, e->pos() + m_offset);
+ QLineF line(m_pos, e->position().toPoint() + m_offset);
line.setLength(line.length() * .1);
QPointF dir(line.dx(), line.dy());
m_direction = (m_direction + dir) / 2;
}
- m_pos = e->pos() + m_offset;
+ m_pos = e->position().toPoint() + m_offset;
#if QT_CONFIG(opengl)
if (usesOpenGL()) {
update();
diff --git a/examples/widgets/painting/pathstroke/pathstroke.cpp b/examples/widgets/painting/pathstroke/pathstroke.cpp
index 7dab6f95a2..439bcb2cd0 100644
--- a/examples/widgets/painting/pathstroke/pathstroke.cpp
+++ b/examples/widgets/painting/pathstroke/pathstroke.cpp
@@ -559,7 +559,7 @@ void PathStrokeRenderer::mousePressEvent(QMouseEvent *e)
m_activePoint = -1;
qreal distance = -1;
for (int i = 0; i < m_points.size(); ++i) {
- qreal d = QLineF(e->pos(), m_points.at(i)).length();
+ qreal d = QLineF(e->position().toPoint(), m_points.at(i)).length();
if ((distance < 0 && d < 8 * m_pointSize) || d < distance) {
distance = d;
m_activePoint = i;
@@ -574,7 +574,7 @@ void PathStrokeRenderer::mousePressEvent(QMouseEvent *e)
// If we're not running in small screen mode, always assume we're dragging
m_mouseDrag = !m_smallScreen;
- m_mousePress = e->pos();
+ m_mousePress = e->position().toPoint();
}
void PathStrokeRenderer::mouseMoveEvent(QMouseEvent *e)
@@ -582,11 +582,11 @@ void PathStrokeRenderer::mouseMoveEvent(QMouseEvent *e)
if (!m_fingerPointMapping.isEmpty())
return;
// If we've moved more then 25 pixels, assume user is dragging
- if (!m_mouseDrag && QPoint(m_mousePress - e->pos()).manhattanLength() > 25)
+ if (!m_mouseDrag && QPoint(m_mousePress - e->position().toPoint()).manhattanLength() > 25)
m_mouseDrag = true;
if (m_mouseDrag && m_activePoint >= 0 && m_activePoint < m_points.size()) {
- m_points[m_activePoint] = e->pos();
+ m_points[m_activePoint] = e->position().toPoint();
update();
}
}
@@ -638,7 +638,7 @@ bool PathStrokeRenderer::event(QEvent *e)
if (activePoints.contains(i))
continue;
- qreal d = QLineF(touchPoint.pos(), m_points.at(i)).length();
+ qreal d = QLineF(touchPoint.position(), m_points.at(i)).length();
if ((distance < 0 && d < 12 * m_pointSize) || d < distance) {
distance = d;
activePoint = i;
@@ -646,7 +646,7 @@ bool PathStrokeRenderer::event(QEvent *e)
}
if (activePoint != -1) {
m_fingerPointMapping.insert(touchPoint.id(), activePoint);
- m_points[activePoint] = touchPoint.pos();
+ m_points[activePoint] = touchPoint.position();
}
break;
}
@@ -654,7 +654,7 @@ bool PathStrokeRenderer::event(QEvent *e)
{
// move the point and release
QHash<int,int>::iterator it = m_fingerPointMapping.find(id);
- m_points[it.value()] = touchPoint.pos();
+ m_points[it.value()] = touchPoint.position();
m_fingerPointMapping.erase(it);
break;
}
@@ -663,7 +663,7 @@ bool PathStrokeRenderer::event(QEvent *e)
// move the point
const int pointIdx = m_fingerPointMapping.value(id, -1);
if (pointIdx >= 0)
- m_points[pointIdx] = touchPoint.pos();
+ m_points[pointIdx] = touchPoint.position();
break;
}
default:
diff --git a/examples/widgets/painting/shared/hoverpoints.cpp b/examples/widgets/painting/shared/hoverpoints.cpp
index f834f315f9..9fe947cedc 100644
--- a/examples/widgets/painting/shared/hoverpoints.cpp
+++ b/examples/widgets/painting/shared/hoverpoints.cpp
@@ -102,7 +102,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
return true;
QMouseEvent *me = (QMouseEvent *) event;
- QPointF clickPos = me->pos();
+ QPointF clickPos = me->position().toPoint();
int index = -1;
for (int i=0; i<m_points.size(); ++i) {
QPainterPath path;
@@ -170,7 +170,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
if (!m_fingerPointMapping.isEmpty())
return true;
if (m_currentIndex >= 0)
- movePoint(m_currentIndex, ((QMouseEvent *)event)->pos());
+ movePoint(m_currentIndex, ((QMouseEvent *)event)->position().toPoint());
break;
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
@@ -197,7 +197,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
if (activePoints.contains(i))
continue;
- qreal d = QLineF(touchPoint.pos(), m_points.at(i)).length();
+ qreal d = QLineF(touchPoint.position(), m_points.at(i)).length();
if ((distance < 0 && d < 12 * pointSize) || d < distance) {
distance = d;
activePoint = i;
@@ -207,7 +207,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
}
if (activePoint != -1) {
m_fingerPointMapping.insert(touchPoint.id(), activePoint);
- movePoint(activePoint, touchPoint.pos());
+ movePoint(activePoint, touchPoint.position());
}
}
break;
@@ -215,7 +215,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
{
// move the point and release
QHash<int,int>::iterator it = m_fingerPointMapping.find(id);
- movePoint(it.value(), touchPoint.pos());
+ movePoint(it.value(), touchPoint.position());
m_fingerPointMapping.erase(it);
}
break;
@@ -224,7 +224,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event)
// move the point
const int pointIdx = m_fingerPointMapping.value(id, -1);
if (pointIdx >= 0) // do we track this point?
- movePoint(pointIdx, touchPoint.pos());
+ movePoint(pointIdx, touchPoint.position());
}
break;
default: