You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
This discussion was converted from issue #26 on December 15, 2023 13:28.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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
BetaWas this translation helpful?Give feedback.
All reactions