Really wishing this function existed. Can someone explain why it doesnt' exist?

I'm using it in conjunction with QVariantMap and QVariant list, where I want to 
change the value held at key or index. But in a nested map or list, since 
value() returns a copy, the change does not persist in the container.

QVariantMap mapOfMap;
QVariantMap map {{"key", QRect(0,0,5,5)}};
mapOfMap["map"]=map;
mapOfMap["map"].toMap()["key"] = QRect(1,1,6,6); // copies all the way down, 
changed a copy of mapOfMap["map"].toMap()["key"], gets discarded
map = mapOfMap["map"].toMap();
map["key"] = QRect(1,1,6,6); // changed a copy of mapOfMap["map"].toMap()["key"]
mapOfMap["map"]=map // but we set the copy to be in the original map, so it'll 
stay

Help?
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to