I have a function read
(that takes and returns void
), which stores data from a file into a QHash<QString,QHash<QString,QString> >
-- for clarity, let's call any QHash fitting this template hash
. My aim was to make a "master" list of all the hash
es that exist, which would be a QHash<QHash<QString,QHash<QString,QString> > >
-- let's call this masterHash
. Within read
, everything is fine: masterHash["hash1"]
and hash1
are identical.
I have another function write
(that takes a QString of the form"hash1"
and returns void
), which stores data from masterHash["hash1"]
to a file. Now, this was my aim in creating masterHash
in the first place -- to access hash1
from "hash1"
. Within write
, hash1
still contains the things that were stored in read
, but masterHash["hash1"]
is now empty (though masterHash
still contains the key "hash1"
).
What am I doing wrong or missing? There is no QHash dereferencing anywhere. (Originally, I didn't even store to hash1
, but I was trying to figure out why masterHash["hash1"]
wasn't saving.)
Alternately, is there a better way to achieve the same goal (pointing to a hash using a string of its name)?