>>> from PyQt4 import QtCore
>>> str = QtCore.QString('Hello')
AttributeError: 'module' object has no attribute 'QString'
>>> QtCore.QString._init_(self)
AttributeError: 'module' object has no attribute 'QString'
Yes, I've read QString Class Reference
Why can't I import QString
from QtCore
, as specified in the docs ?
In Python 3, QString is automatically mapped to the native Python string by default:
The QString class is implemented as a mapped type that is automatically converted to and from a Python string. In addition a None is converted to a null QString. However, a null QString is converted to an empty Python string (and not None). (This is because Qt often returns a null QString when it should probably return an empty QString.)
The QChar and QStringRef classes are implemented as mapped types that are automatically converted to and from Python strings.
The QStringList class is implemented as a mapped type that is automatically converted to and from Python lists of strings.
The QLatin1Char, QLatin1String and QStringMatcher classes are not implemented.
http://pyqt.sourceforge.net/Docs/PyQt4/qstring.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With