Skip to content

Commit

Permalink
conditional for qt < 6.3 QMutableEventPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mnutt committed Jan 15, 2024
1 parent 1627146 commit ee690e4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Tools/QtTestBrowser/launcherwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,18 +694,39 @@ bool LauncherWindow::eventFilter(QObject* obj, QEvent* event)
// If the keyboard point is already pressed, release it.
// Otherwise create it and append to m_touchPoints.
if (m_touchPoints.size() > 0 && m_touchPoints[0].id() == 1) {
#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
QMutableEventPoint point;
point.updateFrom(m_touchPoints[0]);
point.setState(QEventPoint::Released);
m_touchPoints[0] = point;
#else
QMutableEventPoint::setState(m_touchPoints[0], QEventPoint::Released);
#endif
sendTouchEvent();
} else if (m_touchPoints.size() > 1 && m_touchPoints[1].id() == 1) {
#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
QMutableEventPoint point;
point.updateFrom(m_touchPoints[0]);
point.setState(QEventPoint::Released);
m_touchPoints[1] = point;
#else
QMutableEventPoint::setState(m_touchPoints[1], QEventPoint::Released);
#endif
sendTouchEvent();
} else {
QEventPoint touchPoint(1, QEventPoint::Pressed, m_view->mapFromGlobal(QCursor::pos()), QCursor::pos());
m_touchPoints.append(touchPoint);
sendTouchEvent();

// After sending the event, change the touchpoint state to stationary
#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
QMutableEventPoint point;
point.updateFrom(m_touchPoints.last());
point.setState(QEventPoint::Stationary);
m_touchPoints[m_touchPoints.length() - 1] = point;
#else
QMutableEventPoint::setState(m_touchPoints.last(), QEventPoint::Stationary);
#endif
}
}

Expand Down

0 comments on commit ee690e4

Please sign in to comment.