ok thanks for pointing out error i will try and will post my result i have edited the bug in the previous post.
ok thanks for pointing out error i will try and will post my result i have edited the bug in the previous post.
To me the proper way of doing what the thread author wants is:
Qt Code:
if(e->buttons() & (Qt::LeftButton|Qt::RightButton)) doSomething(); else baseClass::mousePressEvent(e); }To copy to clipboard, switch view to plain text mode
One might also use == instead of & depending on the effect one wants to obtain.
i tried u r code it enters if condition even if one button is clicked .but the author of post wants only when both the buttons are active.
this can be done by
i have tested it and it worksif(event->buttons() == (Qt::LeftButton | Qt::RightButton))
code();
but one question why do we use or operator and that too unary.
Bookmarks