QSwipeGesture with mouse to control qstackedwidget
Solved
General and Desktop
-
Hi ,all :
here are some topic:
https://forum.qt.io/topic/18129/solved-how-to-implement-qpangesture-and-qswipegesture-for-touch-screen-desktop-programming
https://forum.qt.io/topic/27422/solved-qswipegesture-implementation-on-desktopseems they don't sloved. on stackoverflow, i try and it work with pangesture:
https://stackoverflow.com/questions/49287314/qgestureevent-for-mouse
and i modify as swipegesture, but nothing happen:if(mouse->type() == QMouseEvent::MouseButtonPress){ QSwipeGesture * gesture = qobject_cast<QSwipeGesture*>(state); if(gesture != 0){ m_panning = true; m_startpoint = mouse->pos(); gesture->setSwipeAngle(0.0); return TriggerGesture; } } if(m_panning && (mouse->type() == QMouseEvent::MouseMove)){ QSwipeGesture * gesture = qobject_cast<QSwipeGesture*>(state); if(gesture != 0){ float_t a = twoPointDegree(mouse->pos() , m_startpoint); gesture->setSwipeAngle(a); return TriggerGesture; } } if(mouse->type() == QMouseEvent::MouseButtonRelease){ QSwipeGesture * gesture = qobject_cast<QSwipeGesture*>(state); if(gesture != 0){ QPointF endpoint = mouse->pos(); if(m_startpoint == endpoint){ return CancelGesture; } m_panning = false; float_t a = twoPointDegree(mouse->pos() , m_startpoint); gesture->setSwipeAngle(a); return FinishGesture; } }
anyone can help?