Hey all,

I am having some trouble serializing a QHash. Following this snippit I attempted this:

Qt Code:
  1. #include <QtCore/QCoreApplication>
  2. #include <QHash>
  3. #include <QVariant>
  4. #include <QDebug>
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8.  
  9. QHash<QString,QVariant> hash;
  10. hash.insert("Key1",1);
  11. hash.insert("Key2","thing2");
  12.  
  13. QDataStream ds(&ba, QIODevice::WriteOnly);
  14. ds << hash;
  15. qDebug() << ds;
  16.  
  17. }
To copy to clipboard, switch view to plain text mode 

However, when I run it, qDebug() spits this out:
Qt Code:
  1. QIODevice::read: WriteOnly device
  2. QIODevice::read: WriteOnly device
  3. QIODevice::read: WriteOnly device
To copy to clipboard, switch view to plain text mode 

What am I doing wrong?

Thanks!
-J