Hi I am trying to save QList into QDataStream and reading from QDataStream.
I have this code.
writing:
Qt Code:
  1. QFile file(fileName);
  2. if (!file.open(QIODevice::WriteOnly))
  3. return false;
  4.  
  5. QDataStream outStream(&file);
  6. outStream.setVersion(QDataStream::Qt_4_4);
  7.  
  8. outStream << (quint32)0xA0B0C0D0;
  9. outStream << (qint32)123;
  10.  
  11. outStream << list;
To copy to clipboard, switch view to plain text mode 
It seems good, but when I try to read file like this.
Qt Code:
  1. QFile file(fileName);
  2. if(!file.open(QIODevice::ReadOnly))
  3. return false;
  4.  
  5. QDataStream inStream(&file);
  6. inStream.setVersion(QDataStream::Qt_4_4);
  7.  
  8. quint32 magicWord;
  9. inStream >> magicWord;
  10. if (magicWord != 0xA0B0C0D0)
  11. return false;
  12.  
  13. while(!file.atEnd())
  14. {
  15. inStream >> list;
  16. }
To copy to clipboard, switch view to plain text mode 
list is private QList of my items. I thought that it will be OK according THIS, but it isnot Could someone help me please, how can I solve this?