Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to stop a Release action immediately after longPress for a Button
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 992 Views 1 Watching
  • 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 Offline
    R Offline
    RG90
    wrote on last edited by RG90
    #1

    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
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      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
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved