It's easy to convert a QVector<int> to QVariant but the otherwise is not trivial
QVector<int> v;
v.append(1);
v.append(2);
v.append(3);
QVariant var = QVariant::fromValue(v);
QVector v2(var.toList().toVector()); // fails, returns QVector<QVariant>
First of all: is there any Qt idiom to automatically convert that back or do I have to iterate manually over the var.toList() collection?
Besides, the whole operation is quite costly: first a QList is constructed, then a QVector is constructed, then the QVector is copied back into v2. Is there any way to convert a QVariant directly into QVector? Does Qt support rvalue references itself?