If you want to track events of other application than yours, it might not be possible since its an OS level operation.
If you want to track events in your application, you might consider using event filters.
QObject::installEventFilter