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. Connecting the push of a button with a QPushButton?
QtWS25 Last Chance

Connecting the push of a button with a QPushButton?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 959 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.
  • P Offline
    P Offline
    Pedro_Monteiro
    wrote on last edited by Pedro_Monteiro
    #1

    Hello, how can I connect the push of a keyboard key (up, down left, right) with 4 different QPushButton?
    I've tried the QShortcut class, but I did not find examples that can give me a good explanation.

    RatzzR 1 Reply Last reply
    0
    • P Pedro_Monteiro

      Hello, how can I connect the push of a keyboard key (up, down left, right) with 4 different QPushButton?
      I've tried the QShortcut class, but I did not find examples that can give me a good explanation.

      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by Ratzz
      #2

      @Pedro_Monteiro
      You can use QShortcut with QKeySequence with key enum.
      and connect something like this

         connect(shortcut, SIGNAL(activated()), this, SLOT(on_pushButton_Up_clicked()));

      --Alles ist gut.

      P 1 Reply Last reply
      1
      • RatzzR Ratzz

        @Pedro_Monteiro
        You can use QShortcut with QKeySequence with key enum.
        and connect something like this

           connect(shortcut, SIGNAL(activated()), this, SLOT(on_pushButton_Up_clicked()));
        P Offline
        P Offline
        Pedro_Monteiro
        wrote on last edited by
        #3

        @Ratzz Thanks, you saved me.

        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