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. OnPressAndHold emit signal every 'n' ms?
Forum Update on Monday, May 27th 2025

OnPressAndHold emit signal every 'n' ms?

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 5 Posters 6.9k Views
  • 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.
  • L Offline
    L Offline
    lunatic
    wrote on last edited by
    #1

    following problem, imagine an user would press a button for a few seconds to fast-forward the current song.
    how could I solve this problem?

    if the user presses the button, the signal is only emitted once.

    any suggestions?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      Why not to use pair of onPressed and onReleased?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        baysmith
        wrote on last edited by
        #3

        Start repeating timer and stop the timer if the button release event occurs.

        Nokia Certified Qt Specialist.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vcsala
          wrote on last edited by
          #4

          Just to better understand: do you want to have a kind of key repetation feature (eg. emitting signal in every half seconds if the user holds the key pressed)?

          1 Reply Last reply
          0
          • B Offline
            B Offline
            baysmith
            wrote on last edited by
            #5

            onPressAndHold is a MouseArea event not a key event

            Nokia Certified Qt Specialist.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lunatic
              wrote on last edited by
              #6

              wow, in 7 minutes 4 replies. nice :P

              I'm sorry, with button I meant a custom widget.

              so the timer suggestion is a nice idea. are there any other ideas ?
              if not, thanks Bradley!

              1 Reply Last reply
              0
              • V Offline
                V Offline
                vcsala
                wrote on last edited by
                #7

                I know, I just wanted to catch the idea behind with a kind of synonim.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  blam
                  wrote on last edited by
                  #8

                  Take a look at the example in examples/declarative/modelviews/listview/dynamic.qml (also online at http://doc.qt.nokia.com/4.7-snapshot/declarative-modelviews-listview-dynamiclist-qml.html). The example uses a "PressAndHold" button (defined in a subdirectory, content/PressAndHold.qml) that emits clicked() multiple times when the mouse button is held down.

                  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