filcuc / nimqml

Qt Qml bindings for the Nim programming language
Other
164 stars 20 forks source link

[Question] Struggling to understand *abstractitemmodel* example: setup and delete #26

Closed mantielero closed 3 years ago

mantielero commented 4 years ago

I am trying to understand the abstractitemmodel example.

I don't get these few lines. When I look at the QAbstractListModel subclassing documentation I am not managing to see where those delete and setup are explained.

Any help is welcomed. Regards.

filcuc commented 4 years ago

Sadly they're needed in order to make inheritance work. The setup is the corrisponding class constructor. When creating your own subclass simply call it in your constructor method. Delete is the same. It should be called during destruction. In nim a simply attach a custom deleter when invoking new