Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPushButton::pressed()
QtWS25 Last Chance

QPushButton::pressed()

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.2k 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.
  • ivanicyI Offline
    ivanicyI Offline
    ivanicy
    wrote on last edited by
    #1

    Hello!

    I am trying to do something when I push a button. I thought that when I press a button (QPushButton::pressed()), the function inside the button will execute in loop, but it only enters the slot once.

    What can I do? Thank you very much!

    raven-worxR 1 Reply Last reply
    0
    • ivanicyI ivanicy

      Hello!

      I am trying to do something when I push a button. I thought that when I press a button (QPushButton::pressed()), the function inside the button will execute in loop, but it only enters the slot once.

      What can I do? Thank you very much!

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @ivanicy said in QPushButton::pressed():

      the function inside the button will execute in loop

      what?? What are you trying to achieve exactly?
      Do you mean that the signal is triggered repeatedly as long as the button is held down?

      The signal is only emitted once when the mouse press event is received.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      ivanicyI 1 Reply Last reply
      3
      • raven-worxR raven-worx

        @ivanicy said in QPushButton::pressed():

        the function inside the button will execute in loop

        what?? What are you trying to achieve exactly?
        Do you mean that the signal is triggered repeatedly as long as the button is held down?

        The signal is only emitted once when the mouse press event is received.

        ivanicyI Offline
        ivanicyI Offline
        ivanicy
        wrote on last edited by
        #3

        @raven-worx

        Is exactly that. I want to keep the button hold and do the function inside it until I released the button.

        mrjjM 1 Reply Last reply
        0
        • ivanicyI ivanicy

          @raven-worx

          Is exactly that. I want to keep the button hold and do the function inside it until I released the button.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ivanicy
          Hi
          If you make a loop inside a button, you will strangulate
          whole application.

          Its better to use the auto repeat feature
          http://doc.qt.io/qt-5/qabstractbutton.html#autoRepeat-prop

          and perform function as long as its repeating the signal

          Looping will make you sad :)

          ivanicyI 1 Reply Last reply
          4
          • mrjjM mrjj

            @ivanicy
            Hi
            If you make a loop inside a button, you will strangulate
            whole application.

            Its better to use the auto repeat feature
            http://doc.qt.io/qt-5/qabstractbutton.html#autoRepeat-prop

            and perform function as long as its repeating the signal

            Looping will make you sad :)

            ivanicyI Offline
            ivanicyI Offline
            ivanicy
            wrote on last edited by
            #5

            @mrjj Thank you very much!!!

            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