问题
I can't find a way to convert my QList<T>
to a QVariant
.
There's a constructor QVariant(const QList<QVariant> &val)
, but no constructor for QList<T>
, is it possible to convert directly a QList<T>
?
回答1:
Example
QList<int> ints{1,2,3};
QVariant var = QVariant::fromValue<QList<int>>(ints);
来源:https://stackoverflow.com/questions/44436386/how-to-convert-qlistt-to-qvariant