Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    QML and Qt Quick
    2
    2
    368
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      RG90 last edited by RG90

      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,

      1 Reply Last reply Reply Quote 0
      • E
        Eddy last edited by

        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

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply Reply Quote 0
        • First post
          Last post