I have a problem serializing and reading back a QMap that holds a collection of my class called PID.

In this class I implemented operators << and >> as below, with the help of some good fellas here in this forum.
Qt Code:
  1. QDataStream &operator <<(QDataStream &out, const PID &pid)
  2. {
  3. out << pid.getKp() << pid.getKi() << pid.getKd();
  4. return out;
  5. }
  6.  
  7.  
  8. QDataStream &operator >>(QDataStream &in, PID *pid)
  9. {
  10. double kp;
  11. double ki;
  12. double kd;
  13. in >> kp >> ki >> kd;
  14. pid = new PID();
  15. pid->setKp(kp);
  16. pid->setKi(ki);
  17. pid->setKd(kd);
  18. return in;
  19. }
To copy to clipboard, switch view to plain text mode 

Latter the map is serialized like this
Qt Code:
  1. PID pid;
  2. pid.setKp(34);
  3. pid.setKi(45);
  4. pid.setKd(54);
  5. QString path = appDir.path() + QDir::separator()
  6. + name + TXT_FILE_EXT;
  7. QFile pidFile(path);
  8. pidFile.open(QIODevice::ReadWrite);
  9. QDataStream stream(&pidFile);
  10. QMap<quint8, PID*> pidList;
  11. stream << pidList;
  12.  
  13. pidList.clear();
  14. stream.device()->reset();
  15.  
  16. stream >> pidList;
  17.  
  18. qDebug() << "Pid map size: " << pidList.size() << " File Size: "<< pidFile.size();
  19. pidFile.close();
To copy to clipboard, switch view to plain text mode 
when I run this I get the same "Pid map size: 0 File Size: 8 " even when the map's size is changed in the code. Any Idea how I can get to my goal of serializing the collection of PIDs to a file and read back?
Thanks.