how do you use MV in Qt? I’ve tried these two approaches:
-
If there is an existing/legacy
code “data”-classes, I use model
as a facade. The
Model-implementation class gets a
reference to data, and calls its
functions on model-item access
calls. -
For new implementations I derive
the data class from QAbstractModel.
Is there any other way you do it?
The approach I ended up taking is similar to the one you suggest. I am currently using a facade to map between my legacy data model into the QAbstractModel.
At first the facade was a bit too complicated, but slowly I am pulling functionality out of the facade model and pushing it into my data model. And then one day I will remove the facade completely so that my model is THE model.
Having a single model will make my head hurt less.