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. Unexpected type 'QKeySequence'
Qt 6.11 is out! See what's new in the release blog

Unexpected type 'QKeySequence'

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.2k 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.
  • Q Offline
    Q Offline
    qtDevOps
    wrote on last edited by
    #1
    class EditName(Ui_MainWindow):
    def __init__(self, window):
        self.setupUi(window)
    
        QShortcut(
            QKeySequence('Ctrl+1'), self).activated.connect(lambda: self.ComboEditType.setCurrentIndex(0))
    

    When I run this code it produces following error. I did search but didn't find any solution to this error.

    TypeError: arguments did not match any overloaded call:
      QShortcut(QWidget): argument 1 has unexpected type 'QKeySequence'
      QShortcut(Union[QKeySequence, QKeySequence.StandardKey, str, int], QWidget, member: PYQT_SLOT = 0, ambiguousMember: PYQT_SLOT = 0, context: Qt.ShortcutContext = Qt.WindowShortcut): argument 2 has unexpected type 'EditName'
    

    I think self (i.e EditName class) inside QSequence is causing the problem. Any suggestion on how to solve this?

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

      Hi and welcome to devnet,

      self is not a widget, the window parameter is.

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

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

        As an additional note, this is a generated class, you shall not modify it.

        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
        1
        • SGaistS SGaist

          Hi and welcome to devnet,

          self is not a widget, the window parameter is.

          Q Offline
          Q Offline
          qtDevOps
          wrote on last edited by
          #4

          @SGaist said in Unexpected type 'QKeySequence':

          the window parameter is

          Thank you so much !!

          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