我想将数据(从文件中读取)添加到QTableView,但查看http://srinikom.github.io/pyside-docs/PySide/QtGui/QTableView.html#qtableview处的函数, 似乎没有任何东西可以做到这一点。
我一直认为我应该使用TableView而不是tabelWidget来获取自定义数据。
答案 0 :(得分:1)
使用QTableView
的原因是,不是直接向视图添加数据,而是使用模型 - 视图 - 控制器范例。
您需要create a subclass QAbstractItemModel,然后使用QTableView
继承的QAbstractItemView.setModel()
设置模型。