Unsolved What is the function to know if the screen is pressed or not
-
Hi,
On Android with qt 5.13.1, I would like to know if the touch screen is pressed or not.
Is there a function that manages this?I'm a beginner, can you help me ?
Thanks
-
If you are using QML, you can use a MouseArea spanning the whole application window, something like:
ApplicationWindow { // Your normal code here... MouseArea { onClicked: { // Or use "onPressed" console.log("Screen has been pressed!") // This will propagate the click further into your app mouse.accepted = false } } }
-
hi @NGV_Maxime ,
to add to @sierdzio answer, you need to set the size of the mousearea@sierdzio said in What is the function to know if the screen is pressed or not:
MouseArea {
anchors.fill : parent //<< give a size
onClicked: { -
Hi,
Thank for your answers.
No, I do not use QML.
My problem is as follows :
A pushbutton stay pressed while I no longer press this button.
To highlight this problem you must follow the following procedure:
1: Press (hold) with a first finger on the button
2: With a 2nd finger, press another area of the screen
3: Removing 1st finger
4: Removing the 2nd fingerIt's an app for Android.
The event "released" is not activated in this case, the button remains visually pressed.
My idea was to check in real time if a finger is pressed on the screen so as to disable the pressed button
Can you help me ?
thank you
Envoyer des commentaires
Historique
Enregistré
Communauté
-
@LeLev said in What is the function to know if the screen is pressed or not:
hi @NGV_Maxime ,
to add to @sierdzio answer, you need to set the size of the mouseareaOh, right, I've missed that crucial detail :D Thanks for noticing.
-
@NGV_Maxime said in What is the function to know if the screen is pressed or not:
It's an app for Android.
The event "released" is not activated in this case, the button remains visually pressed.
My idea was to check in real time if a finger is pressed on the screen so as to disable the pressed button
Can you help me ?OK so QtWidgets, right? Which Qt version are you using? I think there was a similar bug that was fixed quite recently. So if you are using some older version, please check with newest (5.12.4 or 5.13.1).
You can see all mouse events that come into your app by installing a custom event filter https://doc.qt.io/qt-5/qobject.html#installEventFilter