Skip to content

'number' operators are set up incorrectly #10

Closed
@iestynne

Description

@iestynne

Hi!

Thanks to everyone involved in creating PythonQt, being able to glue Qt/Python/OGL together is an absolute godsend for productivity :)

Anyway, I found an issue and thankfully was able to diagnose the cause. For all 'number' type objects wrapped by PythonQt (e.g QVector3D), the standard operators for '+', '-' an d'' are set up incorrectly - they are set to the 'in-place' versions '+=', '-=' and '=' instead, so for example:

print str( vecA + vecB )

...will actually execute this:

print str( vecA += vecB )

...so the value of vecA will unexpectedly change!

The erroneous code is in initializeSlots() in PythonQtClassWrapper.cpp.

The fix is trivial (just replace an instance of 'nb_add' with 'nb_inplace_add', etc), but I'm not sure what the rules/procedures are for updating the PythonQt code.

FYI I am using the latest code, downloaded from here:

http://sourceforge.net/projects/pythonqt/files/pythonqt/PythonQt-2.1/PythonQt2.1_Qt4.6.2.zip/download

Hope this is helpful!

iestyn

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions