Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSwipeGesture with mouse to control qstackedwidget

QSwipeGesture with mouse to control qstackedwidget

Scheduled Pinned Locked Moved Solved General and Desktop
1 Posts 1 Posters 114 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    QtTester
    wrote on last edited by
    #1

    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-desktop

    seems 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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved