Important: Please read the Qt Code of Conduct -

How to stop a Release action immediately after longPress for a Button

  • Hi,

    I have implemented longpress button action. But, after a longpress - Release action is getting called and its displaying the unwanted text field on display. How can we stop after an immediate longpress. Here, I am attaching my sample code. Is their is any way to stop an action in QML

            Connections {
                target: keypad.item
                onButtonAction: {
                    if(action == ButtonActions.LONG_PRESS && maintxt.text === "0")
                        textInput += subtxt.text;
                    if (action == ButtonActions.RELEASED)
                        textInput += maintxt.text;


  • Hi RG90 ,

    You could use a timer.
    Have a look at this post to get an idea on how to do it. There it is used to differentiate between double and single clicks based on a chosen time interval.


Log in to reply