QString <-> Python conversion, null/None #175
gregor-anich-uibk
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I use a custom wrapper to provide operators etc for a class. I also provide the py_toString function. Problem is if I return an empty string, then PythonQtInstanceWrapper_str returns the default ("%s (C++ Object %p)", typeName, wrapper->_wrappedPtr).
I was wondering if it would be a good idea to convert a null QString to None and vice versa, but I think this could be a too invasive change breaking existing code, what do you think?
Another option would probably be to make getStringFromObject in PythonQtInstanceWrapper.cpp return a "bool ok" to signal that an empty string was returned by the wrapper, and then not fallback to the default string.
Edit: I chose the second option, see commit bc70661
Beta Was this translation helpful? Give feedback.
All reactions