MouseRelease is called when mouse is hovered out of rectangle

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
4 posts • Page 1 of 1
flindecke
Posts:69
Joined: Wed Jun 24, 2015 1:54 pm

MouseRelease is called when mouse is hovered out of rectangle

Post by flindecke »

I have a problem with a rectangle which uses pressed, release and hover scripts. When ever i press the mouse on the rectangle and release the mouse everything works fine.
When i use a hover script on the rectangle, the mouse release is called, when i left the rectangle while holding the mouse button pressed.

So the mouse released script is called and while i press my finger on the button an move the mouse out of the rectangle.

How can i fix this unexpected behavior?

Hope someone has an idea.
Frank

Attached panel should work on WinCC OA 3.15 and if everything work as in my expectation you would never see a red rectangle

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: MouseRelease is called when mouse is hovered out of rectangle

Post by mkoller »

The rectangle scripts pressed/released are working like on a push button.
You get the released event since the "button" is now disarmed (and the push button widget now shows no longer the pressed state).
This has nothing to do with the hover script.

flindecke
Posts:69
Joined: Wed Jun 24, 2015 1:54 pm

Re: MouseRelease is called when mouse is hovered out of rectangle

Post by flindecke »

Hello Martin,

thanks for the fast reply.
The rectangle scripts pressed/released are working like on a push button.
You get the released event since the "button" is now disarmed (and the push button widget now shows no longer the pressed state).
This has nothing to do with the hover script.
So the behavior is as follows?
1) MousePressed is called, if and only if
a) Mouse button is pressed, or
b) Mouse button is pressed, mouse is moved out of element while holding the button and mouse is moved back into element while holding the button
2) MouseReleased is called, if and only if
a) Mouse button is released, or
b) Mouse button is pressed, mouse is moved out of element while holding the button

As you said, the button is disarmed, so i assume the armed() function does not reflect the mouse button state, because it is set to false.

My problem is, that i need mouse pressed, released on a single element even while hovering over others and i need the release event to start a timer.
I will discuss this with the support team.

Thanks for your patience
Frank

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: MouseRelease is called when mouse is hovered out of rectangle

Post by mkoller »

You list the cases for the script starts correctly.
Also you are right that the "armed" flag of a shape does not reflect the mouse button. It reflects the state of the shape.

To get the current mouse buttons, one would need a new CTRL function using QGuiApplication::mouseButtons().
You could do this in a CTRL extension, we should put this on our TODO list

4 posts • Page 1 of 1