Skip to content

Commit

Permalink
Use QMouseEvent::pos to avoid deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Vogtinator committed Feb 3, 2024
1 parent f8af18e commit 158d059
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lcdwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 158d059

Please sign in to comment.