0
table = QTableView()
model = QStandardItemModel()
table.setModel(model)
r = table.model().rowCount()
c = table.model().columnCount()
tLeft = table.model().index(0, 0)
bRight = table.model().index(r, c)
table.dataChanged(tLeft, bRight).connect(SomeFunction)
AttributeError: 'NoneType' object has no attribute 'connect'
table.dataChanged(索引,索引)。将(someFunction)失败
目标 - 调用SomeFunction
时的项目之一直接由用户在QTableView()
改变。
我该怎么做?我看到NoneType对象不能具有属性连接,但它为什么是NoneType。
请评论。我是一名初学者。 QT5。
它看起来像函数table.dataChanged(tLeft,bRight)返回的是None。应该从'table'对象调用'connect'方法吗? (这只是一个猜测,我从来没有使用过Qt5) –
如果我将它应用于像'table.model()。dataChanged(tLeft,bRight).connect(SomeFunction)'这样的类型错误:原生Qt信号不可调用' –
你检查过文档吗?哪些对象具有'connect'方法?你见过它的一个例子吗? –