just example from QAsistant
{
if ( obj == textEdit ) {
if ( e
->type
() == QEvent::KeyPress ) { qDebug( "Ate key press %d", k->key() );
return TRUE;
} else {
return FALSE;
}
} else {
// pass the event on to the parent class
}
}
bool MyMainWindow::eventFilter( QObject *obj, QEvent *ev )
{
if ( obj == textEdit ) {
if ( e->type() == QEvent::KeyPress ) {
QKeyEvent *k = (QKeyEvent*)ev;
qDebug( "Ate key press %d", k->key() );
return TRUE;
} else {
return FALSE;
}
} else {
// pass the event on to the parent class
return QMainWindow::eventFilter( obj, ev );
}
}
To copy to clipboard, switch view to plain text mode
read about eventFilter()
Bookmarks