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. Execute different commands on press and release of button
Qt 6.11 is out! See what's new in the release blog

Execute different commands on press and release of button

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 854 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
    mnkyshield
    wrote on last edited by
    #1

    Hi,
    I am an artist and not a programmer. I am creating an interface in QT which connects with an application and executes some commands in there. So far I have figured out how to execute basic commands and python commands, I wish to know how can I have two different commands for press and release of a button in an ui in QT designer.

    So on press the button runs a command in the application
    and on release of the same button another command.

    Sorry if this is too basic, I did google and try to find an answer but am a bit stuck.

    Thanks a lot.

    O 1 Reply Last reply
    0
    • M mnkyshield

      Hi,
      I am an artist and not a programmer. I am creating an interface in QT which connects with an application and executes some commands in there. So far I have figured out how to execute basic commands and python commands, I wish to know how can I have two different commands for press and release of a button in an ui in QT designer.

      So on press the button runs a command in the application
      and on release of the same button another command.

      Sorry if this is too basic, I did google and try to find an answer but am a bit stuck.

      Thanks a lot.

      O Offline
      O Offline
      ofmrew
      wrote on last edited by
      #2

      @mnkyshield Look at all members of QPushButton and you will see that there is a signal for pressed and one for release, so connect those to your methods.

      1 Reply Last reply
      3
      • H Offline
        H Offline
        Hubbard
        wrote on last edited by
        #3

        They are two different 'signals' emitted by the QPushButton class
        so
        Connect(pushButton, SIGNAL(pressed()), this, SLOT(pushButtonPressSlot()))
        and
        Connect(pushButton, SIGNAL(released()), this, SLOT(pushButtonReleaseSlot()))

        1 Reply Last reply
        3
        • M Offline
          M Offline
          mnkyshield
          wrote on last edited by
          #4

          I have found a hacky way of making it work, might have to learn python and QT properly at some time, for now thanks guys :D

          1 Reply Last reply
          1

          • Login

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