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. Simulate mouseMoveEvent not working QT
QtWS25 Last Chance

Simulate mouseMoveEvent not working QT

Scheduled Pinned Locked Moved Unsolved General and Desktop
qmouseevent
2 Posts 2 Posters 928 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.
  • P Offline
    P Offline
    prasanth
    wrote on 18 Mar 2019, 06:04 last edited by prasanth
    #1

    I am trying to grab touch events from one widget and simulate it in another widget.
    The grab and simulate touch events are working fine for mousePressEvent,mouseReleaseEvent.But when I try to
    simualate mouseMoveEvent the corresponding events are not getting in the the destination side.

    void SimulateManager::showWidgets()
    {

    Source.show();
    Destination.show();
    
    connect(&Source, SIGNAL(sigMousePress(QMouseEvent *)), this, SLOT(slotMousePress(QMouseEvent *)));
    connect(&Source, SIGNAL(sigMouseMove(QMouseEvent *)), this, SLOT(slotMouseMove(QMouseEvent *)));
    

    }

    void SourceWidget:: mouseMoveEvent(QMouseEvent *event)
    {
    emit sigMouseMove(event);
    }

    void SourceWidget::mousePressEvent(QMouseEvent *event)
    {
    emit sigMousePress(event);

    }

    void SimulateManager:: slotMousePress(QMouseEvent *event)
    {

     QPoint pPoint(event->pos().x(),event->pos().y());
     QMouseEvent mouseEvent( (QEvent::MouseButtonPress),pPoint,  Qt::LeftButton, Qt::NoButton,Qt::NoModifier   );
     QCoreApplication::sendEvent(&Destination, &mouseEvent);
    

    }

    void SimulateManager:: slotMouseMove(QMouseEvent *event)
    {
    QPoint pPoint(event->pos().x(),event->pos().y());
    QMouseEvent mouseEvent( (QEvent::MouseMove),pPoint, Qt::LeftButton, Qt::NoButton,Qt::NoModifier );
    QCoreApplication::sendEvent(&Destination, &mouseEvent);

    }

    void DesitinationWidget:: mouseMoveEvent(QMouseEvent *event)
    {
    qDebug()<<Q_FUNC_INFO;
    }

    void DesitinationWidget::mousePressEvent(QMouseEvent *event)
    {
    qDebug()<<Q_FUNC_INFO;
    }

    The above code is used for grab and simulate. Basically the (QEvent::MouseMove)+ (Qt::LeftButton) is for scrolling a tablewidget.
    QCoreApplication::sendEvent returns success.Can any one help me with this.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dnino
      wrote on 28 Jan 2020, 19:30 last edited by
      #2

      Did you find the solution please ?

      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