To me the proper way of doing what the thread author wants is:

Qt Code:
  1. void XXX::mousePressEvent(QMouseEvent *e){
  2. if(e->buttons() & (Qt::LeftButton|Qt::RightButton))
  3. doSomething();
  4. else
  5. baseClass::mousePressEvent(e);
  6. }
To copy to clipboard, switch view to plain text mode 

One might also use == instead of & depending on the effect one wants to obtain.