简体   繁体   中英

How to convert custom object to QVariant

I have a class called Segment which contains a few QStrings and is meant to be subclassed.

I created a std::list of Segment objects and would like to convert that list into a QVariantList. But this begins with converting my individual Segment objects into QVariant objects, how can I accomplish this?

我想你正在寻找Q_DECLARE_METATYPE(Segment);.

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