Normally, I myself would implement my own model, inheriting from QAbstractItemModel , and provide my own implementation for presentation functions such as data() to handle the data storage container that I give the model.
If you have code duplication to use QList<T> and std::vector<T> , I would suggest converting one to another by doing:
QList<T> list = QList::fromVector(QVector::fromStdVector(vector));
or another way.
std::vector<T> vector = qlist.toVector().toStdVector();
I would do the latter, but you can also choose.
Based on your additional comments, you can choose two paths:
Path 1:
Add objectA and objectB as follows:
class objectA : baseObject
and
class objectB : baseObject
where baseObject :
struct baseObject { virtual std::string toString() = 0; };
It is probably easier to convert to a string, and then something else.
Path 2 will basically include inside the model, using std::vector<boost::any>() as a container for storing data, so you can implement a subclass of one model QAbstractListModel .
What you should consider is that if your data storage container you can possibly distribute the data view, you are limited by what you can do, because the data() function that will give your view, the element must return a QVariant and it is limited by what you can build it from.