简体   繁体   中英

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

Example

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM