我开始看一些Python和QT(https://www.youtube.com/watch?v=Eq7__6y0jwo&index=3&list=PL19DCiIwVefyQxlDTWlXQ4lnZDPW6_r-q)的教程,但是我遇到了一个错误“qpaint::begin:Paint device returned engine==0,type:0”,我不知道为什么。我的想法是,我想有一个窗口,在3dsMax,Modo,也许作为一个独立的(3dsMax和Modo都与PySide一起提供)。在
有什么想法吗?在
代码如下:
from PySide import QtCore, QtGui
import sys
class PaletteListModel (QtCore.QAbstractListModel):
def __init__(self, colors=[], parent=None):
QtCore.QAbstractListModel.__init__(self, parent)
self._colors = colors
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
listView = QtGui.QListView()
listView.show()
red = QtGui.QColor(255, 0, 0)
green = QtGui.QColor(0, 255, 0)
blue = QtGui.QColor(0, 0, 255)
model = PaletteListModel([red, green, blue])
listView.setModel(model)
sys.exit(app.exec_())
谢谢
尼克
我看到你的代码唯一的错误是你继承了QAbstractListModel而没有实现抽象方法。在
从这里的文档:http://doc.qt.io/qt-5/qabstractlistmodel.html#details
有没有遗漏代码?你曾经创建过一个qpanter对象吗?在
相关问题 更多 >
编程相关推荐