Difference between '&' and '==' while using Qt mouse functions?
I was reading the documentation of Qt example of "scribble". There I
stumbled across the following piece of code:
void ScribbleArea::mouseMoveEvent(QMouseEvent *event)
{
if ((event->buttons() & Qt::LeftButton) && scribbling)
drawLineTo(event->pos());
}
void ScribbleArea::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton && scribbling) {
drawLineTo(event->pos());
scribbling = false;
}
}
One question arised in my mind on whether there's actually any difference
between event->button() == Qt::LeftButton and (event->buttons() &
Qt::LeftButton). Could you please explain? Thanks.
No comments:
Post a Comment