Why is this setter a slot?
Druage opened this issue · 1 comments
https://github.com/filcuc/nimqml/blob/master/examples/qtobjectmacro/contact.nim#L21
This does not need to be a slot for the Q_PROPERTY to be able to access it.
Also for further questions like these, would you prefer me to just submit a pull request or open more issues?
The short answer: it need to be a slot for a limit in the current implementation.
The long answer:
Currently the QtObject macro generates a onSlotCalled method. This method dispatch a slot invokation to the appropiate proc or method and generates its body by looking at the proc/methos tagged with the {.slot.} pragma. In the C++ DOtherSide library everytime a property is read/write the onSlotCalled method is invoked with the property read/write function.
In other words:
The QtObject macro in nim should add entries inside the onSlotCalled method for both proc/methods tagged with the {.slot.} pragma and also for those listed in the QtProperty sections
Furthermore i think that some adjustments should be made in the C++ library for implementing this new feature.
If you're planning to contribute please don't do it in the master branch. Currently the dev branch is "ObjectFactories" for both the C++ library and D/Nim language bindings. A lot of things changed for adding support for registering singletons and custom objects in Qml.
I'm working hard to bring out the new 5.0.0 version between this week and the next one. After this work is brought in we can develop and improve this behaviour.