First of all you should show the code where you are registering event filter.
Secondly way you are verifying that this is the event you what to filter is not so good. You should verify specific widget not the type, so it should be something like:
def eventFilter(self, source, event):
if event.type() == QEvent.MouseButtonPress:
if source == self.txtEditor :
pos=event.pos()
cursor=self.txtEditor.cursorForPosition(pos)
cursor.select(QTextCursor.WordUnderCursor)
txtClicked=cursor.selectedText()
self.testCommand(str(txtClicked))
return QMainWindow.eventFilter(self, source, event)
Edit:
It is as I suspected: You are caching ALL events for ALL widgets since you have installed event filter on QApplication object. Register event filter on widget you what to track mouse events for. In event filter use use condition as I wrote above.