Exemplo n.º 1
0
bool StelSkyItem::gestureEvent(QGestureEvent *event)
{
	if (QGesture *pinch = event->gesture(Qt::PinchGesture))
		pinchTriggered(static_cast<QPinchGesture *>(pinch));

	return true;
}
bool StelAppGraphicsWidget::gestureEvent(QGestureEvent *event)
{
	qDebug() << "Gesture event";
    if (QGesture *pinch = event->gesture(Qt::PinchGesture))
        pinchTriggered(static_cast<QPinchGesture *>(pinch));
    return true;
}
Exemplo n.º 3
0
//! [gesture event handler]
bool ImageWidget::gestureEvent(QGestureEvent *event)
{
    if (QGesture *swipe = event->gesture(Qt::SwipeGesture))
        swipeTriggered(static_cast<QSwipeGesture *>(swipe));
    else if (QGesture *pan = event->gesture(Qt::PanGesture))
        panTriggered(static_cast<QPanGesture *>(pan));
    if (QGesture *pinch = event->gesture(Qt::PinchGesture))
        pinchTriggered(static_cast<QPinchGesture *>(pinch));
    return true;
}
Exemplo n.º 4
0
bool QgsMapToolPan::gestureEvent( QGestureEvent *event )
{
  qDebug() << "gesture " << event;
  if ( QGesture *gesture = event->gesture( Qt::PinchGesture ) )
  {
    mPinching = true;
    pinchTriggered( static_cast<QPinchGesture *>( gesture ) );
  }
  return true;
}
Exemplo n.º 5
0
bool QgsMapToolPan::gestureEvent( QGestureEvent* event )
{
  if ( QTouchDevice::devices().isEmpty() )
    return true; // no touch support

  qDebug() << "gesture " << event;
  if ( QGesture *gesture = event->gesture( Qt::PinchGesture ) )
  {
    mPinching = true;
    pinchTriggered( static_cast<QPinchGesture *>( gesture ) );
  }
  return true;
}
Exemplo n.º 6
0
bool ClassificationWidget::gestureEvent(QGestureEvent *event){
    if (QGesture *swipe = event->gesture(Qt::SwipeGesture))
            swipeTriggered(static_cast<QSwipeGesture *>(swipe));
    else if (QGesture *pan = event->gesture(Qt::PanGesture))
           panTriggered(static_cast<QPanGesture *>(pan));
       else if (QGesture *tap = event->gesture(Qt::TapGesture))
           tapTriggered(static_cast<QTapGesture *>(tap));
       else if (QGesture *tapAndHold = event->gesture(Qt::TapAndHoldGesture))
           tapAndHoldTriggered(static_cast<QTapAndHoldGesture *>(tapAndHold));
       if (QGesture *pinch = event->gesture(Qt::PinchGesture))
           pinchTriggered(static_cast<QPinchGesture *>(pinch));
       return true;
}
Exemplo n.º 7
0
bool CanvasQt::gestureEvent(QGestureEvent* ge) {
    QGesture* gesture = nullptr;
    QPanGesture* panGesture = nullptr;
    QPinchGesture* pinchGesture = nullptr;

    if((gesture = ge->gesture(Qt::PanGesture))){
        panGesture = static_cast<QPanGesture *>(gesture);
    }
    if ((gesture = ge->gesture(Qt::PinchGesture))){
        pinchGesture = static_cast<QPinchGesture *>(gesture);
    }

    if(panGesture && pinchGesture){
        double absDeltaDist = glm::abs(static_cast<double>(pinchGesture->scaleFactor())-1.0);
        if(absDeltaDist > 0.05 || (lastType_ == Qt::PinchGesture || lastType_ != Qt::PanGesture)){
            lastType_ = Qt::PinchGesture;
            pinchTriggered(pinchGesture);
        }
        else{
            lastType_ = Qt::PanGesture;
            panTriggered(panGesture);
        }
    }
    else if(panGesture){
        lastType_ = Qt::PanGesture;
        panTriggered(panGesture);
    }
    else if(pinchGesture){
        double absDeltaDist = glm::abs(static_cast<double>(pinchGesture->scaleFactor())-1.0);
        if(absDeltaDist > 0.05)
            lastType_ = Qt::PinchGesture;
        pinchTriggered(pinchGesture);
    }

    ge->accept();
    return true;
}
Exemplo n.º 8
0
bool Mouse_Dialog::gestureEvent(QGestureEvent *e)
{
    if(QGesture *swipe = e->gesture(Qt::SwipeGesture)){
        swipeTriggered(static_cast<QSwipeGesture *>(swipe));
    }else if(QGesture *pan = e->gesture(Qt::PanGesture)){
        panTriggered(static_cast<QPanGesture *>(pan));
    }else if(QGesture *pinch = e->gesture(Qt::PinchGesture)){
        pinchTriggered(static_cast<QPinchGesture *>(pinch));
    }else if(QGesture *tap = e->gesture(Qt::TapGesture)){
        tapTriggered(static_cast<QTapGesture *>(tap));
    }else if(QGesture *tap_hold = e->gesture(Qt::TapAndHoldGesture)){
        tap_hold_Triggered(static_cast<QTapAndHoldGesture *>(tap_hold));
    }

    return true;
}
Exemplo n.º 9
0
bool MatrixView::gestureEvent(QGestureEvent *event)
{
    if (QGesture *pinch = event->gesture(Qt::PinchGesture))
        pinchTriggered(static_cast<QPinchGesture *>(pinch));
    return true;
}