QGIS PyQt4 missing QString class

后端 未结 2 583
庸人自扰
庸人自扰 2021-01-19 13:34

i was trying to use a QString in the QGIS Python Console.

from PyQt4.QtCore import QString

but it says:

ImportError: cannot         


        
2条回答
  •  野性不改
    2021-01-19 14:04

    I've not used QGIS, but this is probably because the PyQt has been switched to the new API version 2 (see http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html). In the new API, any Qt function returning or taking a QString takes a Python native string instead. The new API is much more convenient and is the default for PyQt5.

提交回复
热议问题