Auto Generating Model code
I have just gone through a simple ToDo list tutorial (https://www.youtube.com/watch?v=9BcAYDlpuT8) that uses QML and stores the model in C++
There seems to be a lot of 'gotcha's that need to be implemented for each model in C++ (overriding QAbstractListModel). I guess once you do a few it gets easier.
My Question: Is there an Code generator around that you give an IDL to that can do all this tedious work for you ? (In the same way that DJango does this perhaps ?)
AFAIK, no, there's no such tool.
if you haven't seen it i bet it doesn't exist
Just found Thomas Boutroue's macro's that look after a lot of the gotcha's
very interesting . i'll try the same todo list with this and report back
The fact that I'm not aware of such a tool doesn't mean it doesn't exist. There are lots of stuff going on around Qt ;)
IIRC, he has several libraries and helpers that might be of interest, thanks for the reminder !
Oh wow. I just re-implemented the todo list example with heaps less code.
i think i'll keep using this.
now see if i can also use QuickFlux in the same application....
(third try but i usually get lost towards the end of the tutorial )
VRonin last edited by
What I usually feel like suggesting is not to subclass the model at all. use
QStandardItemModelonly via the
QAbstractItemModelinterface (you can force yourself by declaring
QAbstractItemModel* model =new QStandardItemModel(parent);).
If the model's performance is really a drag for your application you can go the length and implement a model subclass (with all its gotchas) changing just 1 line in your existing code