3

How can I derive a QVector from a python list?

I tried

from PyQt4.QtCore import *  #... is QVector herein?
[...]
v=QVector()
for l in list:
    v.append(l)

The key problem is, that I want to use a method that expects QVector as input where passing a simple python list causes an error. And furthermore name 'QVector' is not defined. Please refer to https://gis.stackexchange.com/questions/212252/unexpected-bevaviour-of-qgslinevectorlayerdirector-makegraph-when-passing-li for details.

UPDATE QtCore.PYQT_VERSION_STR gives me '4.10.2', so this shouldn't be a version issue.

Community
  • 1
  • 1
Jochen Schwarze
  • 292
  • 6
  • 27

1 Answers1

4

PyQt has never wrapped the QVector class, and it's unlikely that there will ever be a reason for doing so.

The QgsLineVectorLayerDirector.makeGraph method is expecting a list of QgsPoint instances. So presumably either (1) the list you're passing in doesn't contain objects that are all of the right type, or (2) the Qgs library you're using is broken.

ekhumoro
  • 115,249
  • 20
  • 229
  • 336