Evans Belloeil
Evans Belloeil

Reputation: 2503

How to convert QList<T> to QVariant?

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> ?

Upvotes: 3

Views: 5362

Answers (1)

olya
olya

Reputation: 312

Example

QList<int> ints{1,2,3};
QVariant var = QVariant::fromValue<QList<int>>(ints);

Upvotes: 4

Related Questions