MousePressEvent Simulation not working
-
Dear All,
What can be wrong with the code given below? MousePressEvent is never getting invoked in the event handler of m_sswidget2D object.
@void SSMainWind::on_actionTest_Item_triggered()
{
Dialog *new_dlg = new Dialog(this);
new_dlg->show();QString x_ps = ( new_dlg->getX()); int x_int, y_int ; if (new_dlg->exec() == Dialog::Accepted ) { x_int = new_dlg->getX().toInt(); y_int = new_dlg->getY().toInt(); //installEventFilter(this); QMouseEvent *p = new QMouseEvent(QEvent::MouseButtonPress,QPoint(x_int,y_int), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(this->m_ss2dwidget , p); }
}@
Regards,
-
Hi again,
Well I just defined and implemented another test event handler in main window which worked perfectly, but why the above code doesn't work properly ?
Actually I'm trying to invoke an event handler of widget which is owned by MainWindow, can that be a reason for discrepancy? If so then what is the alternative solution ?
REgards,