Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-333

Methods with default arguments don't always work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • None
    • PySide
    • OS X 10.11, Python 2.7

    Description

      When calling C++ methods that have default arguments, without specifying the arguments, an error is displayed.

      Two examples are from https://codereview.qt-project.org/#/c/164389

      Address book tablemodel.py calls self.dataChanged.emit(index, index) on a QAbstractTableModel object, which displays the following error:

      Traceback (most recent call last):
        File "/Users/alex/Dev/pyside/qt-pyside2-setup/sources/pyside2-examples/examples/itemviews/addressbook/addresswidget.py", line 109, in addEntry
          self.tableModel.setData(ix, address["name"], Qt.EditRole)
        File "/Users/alex/Dev/pyside/qt-pyside2-setup/sources/pyside2-examples/examples/itemviews/addressbook/tablemodel.py", line 137, in setData
          self.dataChanged.emit(index, index)
      TypeError: dataChanged(QModelIndex,QModelIndex,QVector<int>) only accepts 3 arguments, 3 given!
      

      Replacing the code with an explicit argument works though:
      self.dataChanged.emit(index, index, 0) -> works

      Same thing in self.closeEditor.emit(editor) in QStyledItemDelegate in stardelegate.py:

      Traceback (most recent call last):
        File "stardelegate/stardelegate.py", line 137, in commitAndCloseEditor
          self.closeEditor.emit(editor)
      TypeError: closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint) only accepts 2 arguments, 2 given!
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              alexandru.croitor Alexandru Croitor
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes