Dear list, I've just upgraded from PyQt 4.6 (PyQt-Py2.6-gpl-4.6-1.exe) to version 4.7.4 (PyQt-Py2.6-gpl-4.7.4-1.exe), and the upgrade introduced a crash in my program. I've narrowed it down to this example:
from PyQt4 import QtCore, QtGui
class Dialog(QtGui.QDialog):
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.resultsModel = QtGui.QStandardItemModel()
self.resultsModel.appendRow(QtGui.QStandardItem('Item 1'))
self.resultsModel.appendRow(QtGui.QStandardItem('Item 2'))
self.resultsModel.appendRow(QtGui.QStandardItem('Item 3'))
self.layout = QtGui.QVBoxLayout(self)
self.resultsView = QtGui.QTreeView(self)
self.resultsView.setModel(self.resultsModel)
self.layout.addWidget(self.resultsView)
smodel = self.resultsView.selectionModel()
smodel.currentChanged.connect(self.on_change)
@QtCore.pyqtSlot(QtCore.QModelIndex, QtCore.QModelIndex)
def on_change(self, current, previous):
print 'Changed from %s to %s' % (previous.row(), current.row())
app = QtGui.QApplication([])
win = Dialog()
win.show()
app.exec_()
The program crashes with this error:
Traceback (most recent call last):
File "qttest.py", line 26, in <module>
win = Dialog()
File "qttest.py", line 19, in __init__
smodel.currentChanged.connect(self.on_change)
TypeError: on_change() has no overload that is compatible with
currentChanged(QModelIndex,QModelIndex)
When I remove the @QtCore.pyqtSlot() decorator the code runs just
fine. It's a workaround, but I would prefer a clearner solution, or at
least an understanding as to the cause of the exception.
The exception occurs when running on PyQt 4.7.4, Qt 4.6.2 and Python
2.6 on Windows XP.
The same code runs without error on PyQt 4.7.3, Qt 4.6.3 and Python
2.6 on Ubuntu Linux.
Regards,
--
Sybren Stüvel
http://stuvel.eu/
signature.asc
Description: Digital signature
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
