pythonic way to access Cpp Wrapper
Dynamic Python binding for Qt Applications
Brought to you by:
florianlink,
marcusbarann
Hi!
Wrapping my C++ Classes with registerCPPClass and PythonQt works well.
But i want to access my Class the pythonic way.
E.g. if it is implementing a list (must not be QList)
it should support the default operations like len(), [] operators and so on.
if i provide e.g. a len() funtion in the wrapper, i cannot call
len(myobject). i can only call myobject.len()
SWIG support this with special functions like
getitem(int i) { return self->testBit(i); }
void setitem(--)
int len()
What is the PythonQt way to achieve this?
Sorry, the code blocks were formated..
I don't support that yet... I recently added support for mappings, but not yet for sequences.
If I add it, it will still require a special type slot flag on registerCppClass, just having the correct slots is not enough.