I am relatively new to PyQt. I am trying create a custom plugin for Qgis which enables the user to select some features by drawing polygon on the canvas using mouse clicks and then performs intersection of the selected features with another layer. What I want to do is that when user right clicks on the canvas the polygon selection should stop. For this I have to identify between the right and left mouse signals. I have made a dummy function just to test this functionality:
def mousePressEvent(self): print "code enters mousePressEvent function" if event.buttons() == "Qt::LeftButton" print"Left button pressed" else: print"Right button pressed"
I am trying to call this function as follows:
But I am unable to call the function. I guess I am doing something wrong in canvasClicked section.