Skip to content

QString <-> Python conversion, null/None #26

@gregor-anich-uibk

Description

@gregor-anich-uibk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions