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 );
ui.m_pTreeWidget->installEventFilter( this );
To copy to clipboard, switch view to plain text mode
in the eventFilter() function:
{
if( pTarget == ui.m_pTreeWidget )
{
if( pEvent
->type
() == QEvent::MouseButtonPress ) {
return false;
}
}
return QDialog::eventFilter( pTarget, pEvent
);
}
bool ***::(QObject *pTarget, QEvent *pEvent)
{
if( pTarget == ui.m_pTreeWidget )
{
if( pEvent->type() == QEvent::MouseButtonPress )
{
return false;
}
}
return QDialog::eventFilter( pTarget, pEvent );
}
To copy to clipboard, switch view to plain text mode
But I can't get the mouse press event,why?
Thanks a lot !
Bookmarks