luoyes
2nd November 2009, 02:39
I placed a QTreeWidget on a QDialog. And I want to get QTreeWiget's mouse press event,so I use eventFilter like this:
in QDialog's construction
ui.m_pTreeWidget->installEventFilter( this );
in the eventFilter() function:
bool ***::(QObject *pTarget, QEvent *pEvent)
{
if( pTarget == ui.m_pTreeWidget )
{
if( pEvent->type() == QEvent::MouseButtonPress )
{
return false;
}
}
return QDialog::eventFilter( pTarget, pEvent );
}
But I can't get the mouse press event,why?
Thanks a lot !
in QDialog's construction
ui.m_pTreeWidget->installEventFilter( this );
in the eventFilter() function:
bool ***::(QObject *pTarget, QEvent *pEvent)
{
if( pTarget == ui.m_pTreeWidget )
{
if( pEvent->type() == QEvent::MouseButtonPress )
{
return false;
}
}
return QDialog::eventFilter( pTarget, pEvent );
}
But I can't get the mouse press event,why?
Thanks a lot !