[PyQt] new problem pyqt 4.6
Linos
info at linos.es
Wed Oct 7 18:43:52 BST 2009
Hello Phil,
i have detected other problem with clases inheriting from a abstract qt
subclass and a python subclass. Here you have sample code. it gives me this
error when i click the button.
TypeError: QAbstractItemModel.rowCount() is abstract and cannot be called as an
unbound method
---- CODE ----
# -*- coding: utf-8 -*-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class TestPythonClass(object):
def __init__(self):
pass
def rowCount(self):
return 1
class TestSubClass(QAbstractTableModel, TestPythonClass):
def __init__(self, parent):
super(TestSubClass, self).__init__()
TestPythonClass.__init__(self)
class TestWidget(QWidget):
def __init__(self, parent):
super(TestWidget, self).__init__()
self.model = TestSubClass(self)
self.button = QPushButton("test")
self.connect(self.button, SIGNAL("clicked()"), self.model.rowCount)
layout = QVBoxLayout()
layout.addWidget(self.button)
self.setLayout(layout)
def main():
app = QApplication(sys.argv)
widget = TestWidget(None)
widget.show()
return app.exec_()
if __name__ == "__main__":
main()
---- CODE ----
More information about the PyQt
mailing list