无QVariant属性

2024-10-04 01:36:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我用的是from qtswitch import QtGui, QtCore而不是通常的from PyQt4 import QtGui, QtCore,有些地方我遇到了麻烦。在

其中一个是错误,在我的一个函数中,我得到了return QtCore.QVariant(),我一直得到以下错误

AttributeError: 'module' object has no attribute 'QVariant'

函数开头的句子如下:

^{pr2}$

有什么想法吗?或者有没有更多的文件可以让我读到?在


Tags: 函数fromimportreturnobject地方错误attributeerror
1条回答
网友
1楼 · 发布于 2024-10-04 01:36:13

PyqSide不再支持PyqSide Check。已找到:here。在

请注意,在python3上或使用sip.setapi('QVariant', 2)与PyQt4一起使用时,使用return QVariant()会出现此错误:

TypeError: PyQt4.QtCore.QVariant represents a mapped type and cannot be instantiated

我建议不要用这种方式使用QVariant。在

相关问题 更多 >