Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Using two different keys for an Action
QtWS25 Last Chance

Using two different keys for an Action

Scheduled Pinned Locked Moved Solved Qt for Python
1 Posts 1 Posters 174 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.
  • D Offline
    D Offline
    dschiller
    wrote on last edited by SGaist
    #1

    How can I use two different keys for a QAction ?

    from PyQt5.QtWidgets import QAction
    from PyQt5.QtCore import Qt
    
    action = QAction('Any Action', self)
    action.setShortcut(Qt.Key.Key_Enter or Qt.Key.Key_Return)
    

    Found a solution.

    from PyQt5.QtWidgets import QAction
    from PyQt5.QtCore import Qt
    
    shortcuts = [Qt.Key.Key_Enter, Qt.Key.Key_Return]
    action = QAction('Any Action', self)
    action.setShortcuts(shortcuts)
    
    1 Reply Last reply
    0
    • SGaistS SGaist has marked this topic as solved on

    • Login

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