[PyQt] Incompotible signatures

Alexandr N Zamaraev tonal at promsoft.ru
Wed Oct 20 11:23:36 BST 2010


I upgrade my Kubuntu to 10.10.
(libqtcore4 v4.7.0-0ubuntu4, python-sip v4.10.5-0ubuntu1, python-qt4
v4.7.4-0ubuntu1)
And I receive TypeError for my projects

Sample code (file slots.py):
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from PyQt4 import QtCore, QtGui

class TableView(QtGui.QTableView):
  def __init__(self):
    super(TableView, self).__init__()
    self.doubleClicked.connect(self.noSlot)
    self.doubleClicked.connect(self.cppSlot)
    self.doubleClicked.connect(self.pySlot)

  def noSlot(self, index):
    pass

  @QtCore.pyqtSlot('const QModelIndex&')
  def cppSlot(self, index):
    pass

  @QtCore.pyqtSlot(QtCore.QModelIndex)
  def pySlot(self, index):
    pass

def main():
  app = QtGui.QApplication(sys.argv)
  TableView()

if __name__ == '__main__':
  main()

Console session:
$ ./slots.py
Traceback (most recent call last):
  File "./slots.py", line 30, in <module>
    main()
  File "./slots.py", line 27, in main
    TableView()
  File "./slots.py", line 12, in __init__
    self.doubleClicked.connect(self.pySlot)
TypeError: pySlot() has no overload that is compatible with
doubleClicked(QModelIndex)


Why pySlot do not compatible with doubleClicked(QModelIndex)?


More information about the PyQt mailing list