From 158d0599a5ef06f90c3704c18ff9eee704094138 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Fri, 15 Apr 2022 16:46:24 +0200 Subject: [PATCH] Use QMouseEvent::pos to avoid deprecation warnings --- lcdwidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lcdwidget.cpp b/lcdwidget.cpp index 6b71ff8f..c626d132 100644 --- a/lcdwidget.cpp +++ b/lcdwidget.cpp @@ -16,7 +16,8 @@ LCDWidget::LCDWidget(QWidget *parent, Qt::WindowFlags f) void LCDWidget::mousePressEvent(QMouseEvent *event) { - the_qml_bridge->setTouchpadState((qreal)event->x() / width(), (qreal)event->y() / height(), true, event->button() == Qt::RightButton); + const auto pos = event->pos(); + the_qml_bridge->setTouchpadState((qreal)pos.x() / width(), (qreal)pos.y() / height(), true, event->button() == Qt::RightButton); } void LCDWidget::mouseReleaseEvent(QMouseEvent *event) @@ -33,7 +34,8 @@ void LCDWidget::mouseReleaseEvent(QMouseEvent *event) void LCDWidget::mouseMoveEvent(QMouseEvent *event) { - the_qml_bridge->setTouchpadState((qreal)event->x() / width(), (qreal)event->y() / height(), keypad.touchpad_contact, keypad.touchpad_down); + const auto pos = event->pos(); + the_qml_bridge->setTouchpadState((qreal)pos.x() / width(), (qreal)pos.y() / height(), keypad.touchpad_contact, keypad.touchpad_down); } void LCDWidget::showEvent(QShowEvent *e)