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. [SOLVED] Push Button Issue

[SOLVED] Push Button Issue

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

    Hi,

    I have created a pushButton in Qt Designer and two signals-slots connections like the following:

    Sender Signal Receiver Slot
    pushButtonStart pressed MyClass StartPressed()
    pushButtonStop released MyClass StartReleased()

    However I can see in a log file that whenever I click the pushButton, both signals get called.
    Do I need to create the pushButton with some extra option that allows the pressed/released behaviour to work?

    Thanks
    M

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maxg0
      wrote on last edited by
      #2

      I've just discovered what the problem is.

      pushButton pressed/released actually refer to the mouse!
      Is there a way then to define what I need, which is to assign one behavior to when the button is pressed and a different behavior to when the button is released?

      Many Thanks

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Are you thinking about something like toggling ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • M Offline
          M Offline
          maxg0
          wrote on last edited by
          #4

          yes exactly,
          If I link the pushButton to a Radio button (this would show the user the status of the button better) then the SLOT for clicking the button is toggle().
          Can I then read a TRUE/FALSE status of the radio button from here?

          Thanks

          1 Reply Last reply
          0
          • N Offline
            N Offline
            NicuPopescu
            wrote on last edited by
            #5

            for a QPushButton use setCheckable to make it toggling and connect it toggled ( bool checked ) signal to fetch its status

            click= press + release cycle

            toggling happens every click :)

            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