PDA

View Full Version : QTreeWidget and eventFilter



luoyes
2nd November 2009, 03: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 !

wysota
3rd November 2009, 10:21
Filter events on the tree's viewport() and not on the view itself.

luoyes
5th November 2009, 07:38
Filter events on the tree's viewport() and not on the view itself.

Thank you! It works.