@@ -625,7 +625,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
625
625
// request notification of FileOpen events (double clicking a file icon in Mac OS X Finder)
626
626
QgsApplication::setFileOpenEventReceiver ( this );
627
627
628
- #ifndef ANDROID2
628
+ #ifdef ANDROID
629
629
// add reacting to long click in android
630
630
grabGesture (Qt::TapAndHoldGesture);
631
631
#endif
@@ -739,7 +739,7 @@ bool QgisApp::event( QEvent * event )
739
739
openFile ( foe->file () );
740
740
done = true ;
741
741
}
742
- #ifndef ANDROID2
742
+ #ifdef ANDROID
743
743
else if (event->type () == QEvent::Gesture )
744
744
{
745
745
done = gestureEvent (static_cast <QGestureEvent*>(event));
@@ -7277,7 +7277,7 @@ QMenu* QgisApp::createPopupMenu()
7277
7277
return menu;
7278
7278
}
7279
7279
7280
- #ifndef ANDROID2
7280
+ #ifdef ANDROID
7281
7281
bool QgisApp::gestureEvent (QGestureEvent *event)
7282
7282
{
7283
7283
if (QGesture *tapAndHold = event->gesture (Qt::TapAndHoldGesture))
@@ -7291,12 +7291,12 @@ void QgisApp::tapAndHoldTriggered(QTapAndHoldGesture *gesture)
7291
7291
{
7292
7292
if (gesture->state () == Qt::GestureFinished) {
7293
7293
QPoint pos = gesture->position ().toPoint ();
7294
+ QWidget * receiver = QApplication::widgetAt ( pos );
7294
7295
qDebug () << " tapAndHoldTriggered: LONG CLICK gesture happened at " << pos;
7295
- QWidget * receiver = QApplication::widgetAt ( this ->mapToGlobal (pos) );
7296
7296
qDebug () << " widget under point of click: " << receiver;
7297
7297
7298
- QApplication::postEvent ( receiver, new QMouseEvent ( QEvent::MouseButtonPress, pos, Qt::RightButton, Qt::RightButton, Qt::NoModifier ) );
7299
- QApplication::postEvent ( receiver, new QMouseEvent ( QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::RightButton, Qt::NoModifier ) );
7298
+ QApplication::postEvent ( receiver, new QMouseEvent ( QEvent::MouseButtonPress, receiver-> mapFromGlobal ( pos ) , Qt::RightButton, Qt::RightButton, Qt::NoModifier ) );
7299
+ QApplication::postEvent ( receiver, new QMouseEvent ( QEvent::MouseButtonRelease, receiver-> mapFromGlobal ( pos ) , Qt::RightButton, Qt::RightButton, Qt::NoModifier ) );
7300
7300
}
7301
7301
}
7302
7302
#endif
0 commit comments