How do you serialize a QMap?
问题 I'm trying to learn how to serialize QMap objects in windowed applications, using this code: #include "mainwindow.h" #include "ui_mainwindow.h" #include <QFile> #include <QString> #include <QDataStream> #include <QMap> #include <QDebug> void write () { QString filename = "Z:/snippets.txt"; QFile myFile (filename); if (!myFile.open(QIODevice::WriteOnly)) { qDebug() << "Could not write " << filename; return; } QMap<QString,QString> map; map.insert("one","this is 1"); map.insert("two","this is 2