The eventFilter has been modified to be more general.