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 on signal for 500ms every pressed action
Forum Update on Monday, May 27th 2025

QPushButton on signal for 500ms every pressed action

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.3k 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.
  • gfxxG Offline
    gfxxG Offline
    gfxx
    wrote on last edited by
    #1

    Hi, because we use QmodBus and some modbus register is write and cancel in a short time, I try to connect these action to a qpushbutton not toggled .....
    Actually I use Qpushbutton and Toggled event, than I use lambda function and timer, So the user press the toggle button, and after 500 or 1000ms the toggled button become unpressed again. In these time I can write my modbus register, bring the modbus answer than,,, when toggle button is unpressed cancel that modbus register ..... so the slave modbus device "see" a signal similar to a phisical button (or a signal up for 500-1000ms ..... if the waiting and response times of the modbus are not taken into account .... more or less the real time that the slave device see the register up, is 300/400 or 800/900ms, but these is not part of question).

    Is it possible to use some new feature of qt creator or qt 5.10 that allows to use a pushbutton and keep its signal high for a desired time?

    regards
    Giorgio

    bkt

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Qt signals are not on for a duration, its simple a one shot event. ( often a function call)
      so there is no concept of be "high" for the button.

      However, how do you keep the signal otherwise ?

      QPushbutton do have a auto repeat feature, where can continuously send signal if button is being held.
      You can use that feature to emit signal over and over but im not sure that is that you need?

      gfxxG 1 Reply Last reply
      5
      • mrjjM mrjj

        Hi
        Qt signals are not on for a duration, its simple a one shot event. ( often a function call)
        so there is no concept of be "high" for the button.

        However, how do you keep the signal otherwise ?

        QPushbutton do have a auto repeat feature, where can continuously send signal if button is being held.
        You can use that feature to emit signal over and over but im not sure that is that you need?

        gfxxG Offline
        gfxxG Offline
        gfxx
        wrote on last edited by
        #3

        @mrjj sorry for late reply. No autorepeat feature is not good for my pourpose. I know the one shot property of push button .... but I need a 2 state signal with time delay .... so when the user press the button the signal go On and after 500ms tourn Off again whitout user perform ant type of action.

        only these .... actually i use oneshot timer for obtain these result.

        giorgio

        bkt

        aha_1980A 2 Replies Last reply
        2
        • gfxxG gfxx

          @mrjj sorry for late reply. No autorepeat feature is not good for my pourpose. I know the one shot property of push button .... but I need a 2 state signal with time delay .... so when the user press the button the signal go On and after 500ms tourn Off again whitout user perform ant type of action.

          only these .... actually i use oneshot timer for obtain these result.

          giorgio

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @gfxx I would have used a timer also, it looks like the right solution.

          Qt has to stay free or it will die.

          1 Reply Last reply
          5
          • gfxxG gfxx

            @mrjj sorry for late reply. No autorepeat feature is not good for my pourpose. I know the one shot property of push button .... but I need a 2 state signal with time delay .... so when the user press the button the signal go On and after 500ms tourn Off again whitout user perform ant type of action.

            only these .... actually i use oneshot timer for obtain these result.

            giorgio

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @gfxx Can you please mark this thread as SOLVED? Thanks!

            Qt has to stay free or it will die.

            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