mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
Fix annoying Qt touch event deprecations for real this time
This commit is contained in:
parent
71f4d7b222
commit
4b17de7e8c
@ -276,8 +276,13 @@ void ScreenPanel::tabletEvent(QTabletEvent* event)
|
||||
case QEvent::TabletPress:
|
||||
case QEvent::TabletMove:
|
||||
{
|
||||
#if QT_VERSION_MAJOR == 6
|
||||
int x = event->position().x();
|
||||
int y = event->position().y();
|
||||
#else
|
||||
int x = event->x();
|
||||
int y = event->y();
|
||||
#endif
|
||||
|
||||
if (layout.GetTouchCoords(x, y, event->type()==QEvent::TabletMove))
|
||||
{
|
||||
@ -302,8 +307,10 @@ void ScreenPanel::tabletEvent(QTabletEvent* event)
|
||||
|
||||
void ScreenPanel::touchEvent(QTouchEvent* event)
|
||||
{
|
||||
#if QT_VERSION_MAJOR == 6
|
||||
if (event->device()->type() == QInputDevice::DeviceType::TouchPad)
|
||||
return;
|
||||
#endif
|
||||
|
||||
event->accept();
|
||||
|
||||
@ -311,9 +318,15 @@ void ScreenPanel::touchEvent(QTouchEvent* event)
|
||||
{
|
||||
case QEvent::TouchBegin:
|
||||
case QEvent::TouchUpdate:
|
||||
#if QT_VERSION_MAJOR == 6
|
||||
if (event->points().length() > 0)
|
||||
{
|
||||
QPointF lastPosition = event->points().first().lastPosition();
|
||||
#else
|
||||
if (event->touchPoints().length() > 0)
|
||||
{
|
||||
QPointF lastPosition = event->touchPoints().first().lastPos();
|
||||
#endif
|
||||
int x = (int)lastPosition.x();
|
||||
int y = (int)lastPosition.y();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user