I\'ve a QMap
object and I am trying to write its content to a file.
QMap extensions;
//..
for(auto e : extensions)
{
fou
Another convenient method, from the QMap Docs. It allows explicit access to key and value (Java-Style iterator):
QMap extensions;
// ... fill extensions
QMapIterator i(extensions);
while (i.hasNext()) {
i.next();
qDebug() << i.key() << ": " << i.value();
}
In case you want to be able to overwrite, use QMutableMapIterator
instead.
There's another convenient Qt
method, if you're only interested in reading the values, without the keys (using Qt
s foreach
and c++11):
QMap extensions;
// ... fill extensions
foreach (const auto& value, extensions)
{
// to stuff with value
}