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. `TypeError: arguments did not match any overloaded call:`
Forum Updated to NodeBB v4.3 + New Features

`TypeError: arguments did not match any overloaded call:`

Scheduled Pinned Locked Moved Unsolved Qt for Python
6 Posts 3 Posters 5.8k 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.
  • C Offline
    C Offline
    Caeden
    wrote on last edited by Caeden
    #1
    labelLis = []
                self.comboList = []
                self.removeList = []
    
                for i, value in enumerate(_FRIEND_COLLECTION.find_one({'from': self.username[0]}), start=-2):
                    if value in ['from', '_id']:
                        continue
                    labelLis.append(QLabel(value))
                    self.comboList.append(QPushButton(f"Dm {value}"))
                    self.removeList.append(QPushButton(f"Remove {value}"))
                    formLayout.addRow(labelLis[i], self.removeList[i], self.comboList[i])
    

    gives

    Traceback (most recent call last):
      File "c:\Users\caede\Desktop\all-cura\curabitur\phases\viewfriends.py", line 38, in init_Ui
        formLayout.addRow(labelLis[i], self.removeList[i], self.comboList[i])
    TypeError: arguments did not match any overloaded call:
      addRow(self, QWidget, QWidget): too many arguments
      addRow(self, QWidget, QLayout): argument 2 has unexpected type 'QPushButton'
      addRow(self, str, QWidget): argument 1 has unexpected type 'QLabel'
      addRow(self, str, QLayout): argument 1 has unexpected type 'QLabel'
      addRow(self, QWidget): too many arguments
      addRow(self, QLayout): argument 1 has unexpected type 'QLabel'
    

    How can I make it accept 3/possibly more arguments? Im using scroll area btw.

    ps:

    formLayout =QFormLayout()
    groupBox = QGroupBox("There are your friends")
    

    and:

    groupBox.setLayout(formLayout)
                scroll = QScrollArea()
                scroll.setWidget(groupBox)
                scroll.setWidgetResizable(True)
                scroll.setFixedHeight(400)
                layout = QVBoxLayout(self)
                layout.addWidget(scroll)
    
    
    eyllanescE 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      If you want to put more than one widget on a row, put them in a horizontal layout and add the layout to the QFormLayout.

      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
      • C Caeden
        labelLis = []
                    self.comboList = []
                    self.removeList = []
        
                    for i, value in enumerate(_FRIEND_COLLECTION.find_one({'from': self.username[0]}), start=-2):
                        if value in ['from', '_id']:
                            continue
                        labelLis.append(QLabel(value))
                        self.comboList.append(QPushButton(f"Dm {value}"))
                        self.removeList.append(QPushButton(f"Remove {value}"))
                        formLayout.addRow(labelLis[i], self.removeList[i], self.comboList[i])
        

        gives

        Traceback (most recent call last):
          File "c:\Users\caede\Desktop\all-cura\curabitur\phases\viewfriends.py", line 38, in init_Ui
            formLayout.addRow(labelLis[i], self.removeList[i], self.comboList[i])
        TypeError: arguments did not match any overloaded call:
          addRow(self, QWidget, QWidget): too many arguments
          addRow(self, QWidget, QLayout): argument 2 has unexpected type 'QPushButton'
          addRow(self, str, QWidget): argument 1 has unexpected type 'QLabel'
          addRow(self, str, QLayout): argument 1 has unexpected type 'QLabel'
          addRow(self, QWidget): too many arguments
          addRow(self, QLayout): argument 1 has unexpected type 'QLabel'
        

        How can I make it accept 3/possibly more arguments? Im using scroll area btw.

        ps:

        formLayout =QFormLayout()
        groupBox = QGroupBox("There are your friends")
        

        and:

        groupBox.setLayout(formLayout)
                    scroll = QScrollArea()
                    scroll.setWidget(groupBox)
                    scroll.setWidgetResizable(True)
                    scroll.setFixedHeight(400)
                    layout = QVBoxLayout(self)
                    layout.addWidget(scroll)
        
        
        eyllanescE Offline
        eyllanescE Offline
        eyllanesc
        wrote on last edited by eyllanesc
        #3

        @Caeden A QFormLayout has 2 columns, how would the 3 widgets (QLabel and 2 QPushButtons) be placed in the 2 columns?

        If you want more columns then use QGridLayout:

        gridLayout = QGridLayout()
        
        row = 0
        for i, value in enumerate(
            _FRIEND_COLLECTION.find_one({"from": self.username[0]}), start=-2
        ):
            if value in ["from", "_id"]:
                continue
            label = QLabel(value)
            button1 = QPushButton(f"Dm {value}")
            button2 = QPushButton(f"Dm {value}")
            gridLayout.addWidget(label, row, 0)
            gridLayout.addWidget(button1, row, 1)
            gridLayout.addWidget(button2, row, 2)
            row += 1
        

        If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Caeden
          wrote on last edited by
          #4

          @eyllanesc
          thanks, i'll try this - I wasn't aware that you could only place 2

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

            Then please read the QFormLayout documentation, you'll see what is possible.

            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
            • C Offline
              C Offline
              Caeden
              wrote on last edited by
              #6

              @SGaist I'll read the docs next time. I had my suspicions but i also didnt think of the grid method. It works now, thanks eyllansc. I wasn't aware grid worked with scroll area. Thanks!

              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