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