equal
deleted
inserted
replaced
75 |
75 |
76 //Setup zooming animator |
76 //Setup zooming animator |
77 m_zoomAnimator = new QPropertyAnimation(webAnimationItem, "geometry"); |
77 m_zoomAnimator = new QPropertyAnimation(webAnimationItem, "geometry"); |
78 m_zoomAnimator->setDuration(ZoomAnimationDuration); |
78 m_zoomAnimator->setDuration(ZoomAnimationDuration); |
79 connect(m_zoomAnimator, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), this, SLOT(zoomAnimationStateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); |
79 connect(m_zoomAnimator, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), this, SLOT(zoomAnimationStateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); |
|
80 |
|
81 m_gesturesEnabled = true; |
80 } |
82 } |
81 |
83 |
82 ScrollableWebContentView::~ScrollableWebContentView() |
84 ScrollableWebContentView::~ScrollableWebContentView() |
83 { |
85 { |
84 delete m_viewportMetaData; |
86 delete m_viewportMetaData; |
264 bool ScrollableWebContentView::sceneEventFilter(QGraphicsItem* item, QEvent* event) |
266 bool ScrollableWebContentView::sceneEventFilter(QGraphicsItem* item, QEvent* event) |
265 { |
267 { |
266 Q_UNUSED(item); |
268 Q_UNUSED(item); |
267 |
269 |
268 bool handled = false; |
270 bool handled = false; |
269 if (!isVisible()) |
271 |
270 return handled; |
272 if (!isVisible() || !m_gesturesEnabled) { |
|
273 if (event->type() == QEvent::GraphicsSceneContextMenu) |
|
274 return true; |
|
275 else |
|
276 return handled; |
|
277 } |
271 |
278 |
272 //Pass all events to recognizer |
279 //Pass all events to recognizer |
273 handled = m_gestureRecognizer.mouseEventFilter(static_cast<QGraphicsSceneMouseEvent *>(event)); |
280 handled = m_gestureRecognizer.mouseEventFilter(static_cast<QGraphicsSceneMouseEvent *>(event)); |
274 return handled; |
281 return handled; |
275 } |
282 } |
308 sendEventToWebKit(QEvent::GraphicsSceneMousePress, pos); |
315 sendEventToWebKit(QEvent::GraphicsSceneMousePress, pos); |
309 } |
316 } |
310 |
317 |
311 void ScrollableWebContentView::handleRelease(GestureEvent* gestureEvent) |
318 void ScrollableWebContentView::handleRelease(GestureEvent* gestureEvent) |
312 { |
319 { |
|
320 //FIX ME: |
|
321 emit mouseEvent(QEvent::GraphicsSceneMousePress); |
313 //Cache release event to send on release |
322 //Cache release event to send on release |
314 QPointF pos = gestureEvent->position(); |
323 QPointF pos = gestureEvent->position(); |
315 sendEventToWebKit(QEvent::GraphicsSceneMouseRelease, pos); |
324 sendEventToWebKit(QEvent::GraphicsSceneMouseRelease, pos); |
|
325 emit mouseEvent(QEvent::GraphicsSceneMouseRelease); |
316 } |
326 } |
317 |
327 |
318 void ScrollableWebContentView::handleDoubleTap(GestureEvent* gestureEvent) |
328 void ScrollableWebContentView::handleDoubleTap(GestureEvent* gestureEvent) |
319 { |
329 { |
320 if (!m_viewportMetaData->m_userScalable) |
330 if (!m_viewportMetaData->m_userScalable) |
509 event.setScenePos(scenPos); |
519 event.setScenePos(scenPos); |
510 event.setPos(viewportWidget()->webView()->mapFromScene(event.scenePos())); |
520 event.setPos(viewportWidget()->webView()->mapFromScene(event.scenePos())); |
511 event.setButton(Qt::LeftButton); |
521 event.setButton(Qt::LeftButton); |
512 event.setButtons(Qt::LeftButton); |
522 event.setButtons(Qt::LeftButton); |
513 event.setModifiers(Qt::NoModifier); |
523 event.setModifiers(Qt::NoModifier); |
514 |
|
515 viewportWidget()->webView()->page()->event(&event); |
524 viewportWidget()->webView()->page()->event(&event); |
516 } |
525 } |
517 |
526 |
518 } //namespace GVA |
527 } //namespace GVA |