QVariant appears to accept QList<QVariant> and not QVector<QVariant> nor QLinkedList<QVariant>. Is it simply because it sees QList, QVector and QLinkedList as fundamentally similar (in an abstract sense) data structures?
I’m adding and std::vector to a QVariant. If using only the Qt API and not a manual conversion, this requires two conversions:
- From
std::vectortoQVector - From
QVectortoQList
PS: I’m aware that I can add std::vector to QVariant directly with this but I believe in that case it won’t know that it’s a vector of objects.
Simply because QList is by far the most commonly used container type, and adding overloads for all the others would make the QVariant interface even more complex than it already is. In any case, your problem seems to be not that QVariant doesn’t support QVector (it does with a little work) but that QJson doesn’t. I doubt that an extra call to QVector::toList() would cause a significant performance overhead.