Qt6: Several methods of QMouseEvent are deprecated since Qt 6.0

This commit is contained in:
wmayer
2024-09-11 16:33:19 +02:00
parent 3b91fd33e0
commit 77711e6459
2 changed files with 24 additions and 4 deletions

View File

@@ -308,7 +308,11 @@ void ToolBarGrip::mouseMoveEvent(QMouseEvent *me)
return;
}
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QPoint pos = me->globalPos();
#else
QPoint pos = me->globalPosition().toPoint();
#endif
QRect rect(toolbar->mapToGlobal(QPoint(0,0)), toolbar->size());
// if mouse did not leave the area of toolbar do not continue with undocking it

View File

@@ -36,7 +36,7 @@ using namespace MillSim;
namespace CAMSimulator
{
static const float MouseScrollDelta = 120.0f;
static const float MouseScrollDelta = 120.0F;
DlgCAMSimulator::DlgCAMSimulator(QWindow* parent)
: QWindow(parent)
@@ -86,17 +86,33 @@ void DlgCAMSimulator::mouseMoveEvent(QMouseEvent* ev)
int modifiers = (ev->modifiers() & Qt::ShiftModifier) != 0 ? MS_KBD_SHIFT : 0;
modifiers |= (ev->modifiers() & Qt::ControlModifier) != 0 ? MS_KBD_CONTROL : 0;
modifiers |= (ev->modifiers() & Qt::AltModifier) != 0 ? MS_KBD_ALT : 0;
mMillSimulator->MouseMove(ev->x(), ev->y(), modifiers);
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QPoint pnt = ev->pos();
#else
QPoint pnt = ev->position().toPoint();
#endif
mMillSimulator->MouseMove(pnt.x(), pnt.y(), modifiers);
}
void DlgCAMSimulator::mousePressEvent(QMouseEvent* ev)
{
mMillSimulator->MousePress(ev->button(), true, ev->x(), ev->y());
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QPoint pnt = ev->pos();
#else
QPoint pnt = ev->position().toPoint();
#endif
mMillSimulator->MousePress(ev->button(), true, pnt.x(), pnt.y());
}
void DlgCAMSimulator::mouseReleaseEvent(QMouseEvent* ev)
{
mMillSimulator->MousePress(ev->button(), false, ev->x(), ev->y());
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QPoint pnt = ev->pos();
#else
QPoint pnt = ev->position().toPoint();
#endif
mMillSimulator->MousePress(ev->button(), false, pnt.x(), pnt.y());
}
void DlgCAMSimulator::wheelEvent(QWheelEvent* ev)