[Solved]QVariant to QList
-
I have a QVariantMap, and values are QVariantMaps or QStringList, or map with lists... but when I call .toStringList() or .toList() it works fine, but after calling .clear(), removeAt(), takeAt() or something similar, it does nothing! what i am doing wrong?
@myMap.value("value").toMap().value("otherValue").toStringList().removeOne("something");@
-
@
QStringList templist = myMap.value("value").toMap().value("otherValue").toStringList();
templist.removeOne("something");
myMap.value("value").toMap().insert("otherValue",templist);
@Brain to terminal. YMMV.
Basically grab a copy of the list, modify the copy, then reinsert back into your map.