micgooapp
6th June 2013, 10:56
I wanted to create multidimensional arrays in QT.
I am trying to use QVariantMap to do so :
QVariantMap v;
v["lang"] = 1;
v["test"] = 1;
The above code works, but when I try to create another level of array, it doesnt work.
QVariantMap v;
v["test"]["test"] = 1;
How should I get this to work in QT ?
I need this functionality to insert as well as retrieve data from the Map.
I know its possible to create another QVariantMap first and then insert it into the MAP again :
QVariantMap v;
QVariantMap test;
test["a"] = 1;
test["b"] = 2;
v["test"] = test;
However in the above code, I am not able to modify the values of the nested map again like v["test"]["b"] = 3;
Is there anyway to achieve this ?
I am trying to use QVariantMap to do so :
QVariantMap v;
v["lang"] = 1;
v["test"] = 1;
The above code works, but when I try to create another level of array, it doesnt work.
QVariantMap v;
v["test"]["test"] = 1;
How should I get this to work in QT ?
I need this functionality to insert as well as retrieve data from the Map.
I know its possible to create another QVariantMap first and then insert it into the MAP again :
QVariantMap v;
QVariantMap test;
test["a"] = 1;
test["b"] = 2;
v["test"] = test;
However in the above code, I am not able to modify the values of the nested map again like v["test"]["b"] = 3;
Is there anyway to achieve this ?