Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add tap-n-hold function into qtouchweb

  • Loading branch information...
commit 2b39184a9107ee98e53983cfa4e1162d6007aa23 1 parent 07d3c4d
Penk Chen authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 skeleton/archive/qtouchweb/qtouchweb.cpp
14 skeleton/archive/qtouchweb/qtouchweb.cpp
View
@@ -184,10 +184,18 @@ bool FlickCharm::eventFilter(QObject *object, QEvent *event)
QGestureEvent *gestureEvent = dynamic_cast<QGestureEvent*>(event);
if (gestureEvent) {
if (const QGesture *g = gestureEvent->gesture(Qt::TapAndHoldGesture)) {
+ if (g->state() == Qt::GestureStarted) {
+ qDebug() << "tap-n-hold event started";
- if (g->state() == Qt::GestureStarted)
- qDebug() << "tap-n-hold";
- // add custom popup menu here
+ QWebView *webView = dynamic_cast<QWebView*>(object);
+ FlickData *w = d->flickData.value(webView);
+ qDebug() << w->pressPos;
+
+ QContextMenuEvent pressEvent(QContextMenuEvent::Mouse, w->pressPos);
+ QApplication::sendEvent(webView, &pressEvent);
+
+ qDebug() << "context menu sent event";
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.