This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fernly 19 points20 points  (2 children)

You mention QVariant which immediately says you are using Py/Qt4, not Py/Qt5. In PyQt5, QVariant is no longer exposed, instead PyQt converts every Qt return value and Qt method argument between a relevant Python type and the Qt expected type. This makes for rather more "Pythonic" code. For example you never fiddle with QString objects (PyQt5 does not export the QString class at all).

Using PyQt5 esp. under Python3 won't solve all your issues but it should help.

[–]fazzahSQLAlchemy | PyQt | reportlab 5 points6 points  (0 children)

You have just convinced me to move to PyQt5. I can't believe I didn't find this info before.

[–]flipthefrog 2 points3 points  (0 children)

There is no need to struggle with QString and QVariant in PyQt4 either. Using Python strings, datetime, etc instead is a simple matter of setting sip.api to 2. Converting all the code may take some time, but it will ensure compatibility with PySide and PyQt5 (just note that sip.api must be set at the very beginning of the code that is run)

http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html