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;
                    }
                }
            }
    

    Thanks,


  • Moderators

    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.

    Eddy


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.