Modify your method so it takes a 4th argument of QEvent::Type. For the case you describe above, that would be QEvent::MouseButtonPress. Inside your method, you check to see that pEvent->type() == QEvent::MouseButtonPress, and if it is, you call the event handler.
installEventHandler
( "QWidget",
"QMouseEvent",
QEvent::Type eventType,
"mouse_event" );
installEventHandler( "QWidget", "QMouseEvent", QEvent::Type eventType, "mouse_event" );
To copy to clipboard, switch view to plain text mode
Alternatively, modify your event handler so it takes the QEvent pointer:
void eventHandler( QWidget * sender, QEvent * pEvent );
To copy to clipboard, switch view to plain text mode
and inside your event handler you can choose to act only if the event type is MouseButtonPress.
I am not really sure why you are trying to reinvent this wheel. Qt already has the capability to install an event handler on any QObject. See QObject::installEventFilter().
Bookmarks