Look at your if statement and figure out why the following statement works for the left button but not the right:

Qt Code:
  1. if(event->button()==Qt::LeftButton || Qt::RightButton)
To copy to clipboard, switch view to plain text mode 
Your if statement reads as:


  • If the button for this event == Qt::LeftButton or
  • Qt::RightButton is true or non-zero (note how I didn't mention the button?)


Figure out why and you have solved your problem.