PyQt4 - 将列表转换为 QVector
PyQt4 - convert list to QVector
如何从 python 列表中导出 QVector
?
我试过了
from PyQt4.QtCore import * #... is QVector herein?
[...]
v=QVector()
for l in list:
v.append(l)
关键问题是,我想使用一种期望 QVector
作为输入的方法,其中传递一个简单的 python 列表会导致错误。此外 name 'QVector' is not defined
。详情请参考https://gis.stackexchange.com/questions/212252/unexpected-bevaviour-of-qgslinevectorlayerdirector-makegraph-when-passing-li
更新
QtCore.PYQT_VERSION_STR
给我 '4.10.2'
,所以这应该不是版本问题。
PyQt 从未包装 QVector
class,并且不太可能有这样做的理由。
QgsLineVectorLayerDirector.makeGraph
方法需要 QgsPoint
个实例的列表。所以大概是 (1) 您传入的列表不包含所有正确类型的对象,或者 (2) 您正在使用的 Qgs
库已损坏。
如何从 python 列表中导出 QVector
?
我试过了
from PyQt4.QtCore import * #... is QVector herein?
[...]
v=QVector()
for l in list:
v.append(l)
关键问题是,我想使用一种期望 QVector
作为输入的方法,其中传递一个简单的 python 列表会导致错误。此外 name 'QVector' is not defined
。详情请参考https://gis.stackexchange.com/questions/212252/unexpected-bevaviour-of-qgslinevectorlayerdirector-makegraph-when-passing-li
更新
QtCore.PYQT_VERSION_STR
给我 '4.10.2'
,所以这应该不是版本问题。
PyQt 从未包装 QVector
class,并且不太可能有这样做的理由。
QgsLineVectorLayerDirector.makeGraph
方法需要 QgsPoint
个实例的列表。所以大概是 (1) 您传入的列表不包含所有正确类型的对象,或者 (2) 您正在使用的 Qgs
库已损坏。