Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
MouseArea/Button: Prevent double click and clicking on multiple buttons in a row
CarolaC last edited by
I use a stackview to switch between views and I use several MouseAreas as buttons (not the QML Button type) to navigate through the views. The problem is, that I can double click on MouseAreas and then the code in the onClicked slot is executed twice. I know that there is the onDoubleClick slot, but I noticed that the onClicked and the onDoubleClicked slots both receive a signal when I perform a double click, so that doesn't really help.
I also want to prevent that I can hit on another MouseArea after I already clicked on one. I think the problem is that I have a (very short) transition in the stackview which gives the user the time to be able to click on two MouseAreas in one view, before the next view appears.
Of course I could do all this manually with some flags, but I'd like to know if the framework provides something for these problems. Then I could save a lot of work ;) I also tried the QML Button type, but it's the same and it doesn't even provide a doubleClicked signal.