Qt World Summit: Register Today!

How we can know a mouse left pointer or right pointer is moving inside mouse move event while the button is in pressedhold state and moving?

  • When a mouse left or right pointer is pressed and moved i have tried this @event->button == Qt::LeftButton()@ inside mouse move event but it always return zero it does not depend whether the left or right mouse pointer is pressed and moved . How can i detect left mouse pointer or right is pressed and moved inside mouse move event.

  • You mixed up a function and an enumerator member. Try this:
    @event->button() == Qt::LeftButton@

  • No i have tried that only what you are saying i have mistakenly left the braces but i am not getting it.

  • Please show a bigger section of your code, I suggest the whole function if it is not too long. We cannot judge what your application is doing based on a single line of code that appearantly isn't even directly from your sources.

  • Actually i have tried it taking different approach by using flag in mousepressEvent to detect left or right click and used the same flag in mouse move event and now it is working.

Log in to reply