I have a view based on QListWidget, Now I want to send a mouse double click event to my view to invoke view's mouse double click event.
Anybody tell me how to implement this function?
I am using Qt4.3 on XP
I have tried , qApp->postEvent(myView, [create my new double click event])
but my View can't get this double clicke event, why?
my function as below, this event is from one button,
{
if ( NULL != pParent )
{
event->button(),event->buttons(),
event->modifiers());
if ( NULL != pEvent )
{
qApp->postEvent(pParent,pEvent);
}
//pParent->mouseDoubleClickEvent(event);
}
}
void mouseDoubleClickEvent ( QMouseEvent * event )
{
QListWidget* pParent = qobject_cast< QListWidget*>(this->parent());
if ( NULL != pParent )
{
QMouseEvent* pNewMouseEvent = new QMouseEvent(event->type(),event->pos(),
event->button(),event->buttons(),
event->modifiers());
QEvent* pEvent = (QEvent*)(pNewMouseEvent);
if ( NULL != pEvent )
{
qApp->postEvent(pParent,pEvent);
}
//pParent->mouseDoubleClickEvent(event);
}
}
To copy to clipboard, switch view to plain text mode
Thanks in advance
Bookmarks