MouseArea emitting additional 'pressed' signal
-
Hi @aabc,
As the docs says, a click is defined as a press followed by a release, so if you define all the 3 handlers they are surely going to trigger i.e a press followed by release followed by click event. -
Hi p3c0,
The problem is that the 2nd 'pressed' and 'released' events are triggered without someone is actually pressing the MouseArea.
-
@aabc Strange. Can you post some code to test ? Which Qt version and OS are you using ?
-
I'm using Qt 5.3.1 on Linux (Freescale i.mx53 with touch device).
Rectangle { width: 200 height: 200 color: "red" MouseArea { anchors.fill: parent onPressed: console.log("Pressed") onReleased: console.log("Released") onClicked: console.log("Clicked") } }
-
@aabc I tested it on android device with Qt 5.4.1 and it works as expected. Order of signal trigger is pressed, released and clicked. No other ghost events.
-
It doesn't happens all the time. The phenomenon reproduce once per ~15 times.
Another strange issue when it does happen - There are 'pressed' and 'released' events but no 'clicked' event. -
@aabc Could be a bug in Qt 5.3.1. Can you try with latest one ? Just to confirm. So that you can submit a bug report.
-
@aabc , I checked with Qt 5.4.1 MSVC2012 OpenGL 32bit and it works correctly.
Tried many times and able to get pressed , released and clicked signals in order.
You will not get clicked signal in one case ,
if you do press in Rectangle region (200 * 200 ) and do mouse move outside and perform mouse release.
then you will get only pressed & released. -
-
There sould have been 'clicked' signal:
I logged the X and Y coordinates of the 'pressed' and the 'released' and they both were within the MouseArea.