QVariant to QList
Solved
General and Desktop
-
@mzimmers
I don't think a list of variants is/can be the same thing as a list of strings, or converted between the two/treated as such? (AQVariant
cannot be aQString
, it can only contain one.) My thought is you would want to iterate, appending each element?
Note that this is purely a guess as I read this :) -
@JonB I think you're saying basically the same thing that @JoeCFD is, and I think you're both right.
But I still don't know how to cast/convert my QVariant value into a QString (or a QList<QString>).
EDIT: though this comes close:
for (QString qs : value.toStringList()) { item.equipment.append(qs); }
EDIT 2: which means this comes even closer:
case EquipmentRole: item.equipment.clear(); item.equipment.append(value.toStringList());