Hello, i am working on my Quizproject but recently i stumbled upon a problem.I need to serialize my Qt class.I found this example on the internet https://stackoverflow.com/questions/...zation-with-qt, it's the first answer.I want to implement it on a similar way on my class here's my class:
Qt Code:
  1. class Answer{
  2. private:
  3. qint8 id;
  4. QString answer;
  5.  
  6. public:
  7. Answer(QString nAnswer, qint8 nId);
  8. QString getAnswer();
  9. qint8 getId();
  10.  
  11. };
  12.  
  13. class Card
  14. {
  15. private:
  16. QString question;
  17. QVector<Answer> answers;
  18. qint8 solutionId;
  19.  
  20. public:
  21. Card(QString nQuestion, qint8 nSolutionId, QVector<Answer> nAnswers);
  22. QString getQuestion();
  23. QVector<Answer> getAnswers();
  24. qint8 getSolutionId();
  25.  
  26. };
  27.  
  28. Answer::Answer(QString nAnswer, qint8 nId)
  29. {
  30. answer = nAnswer;
  31. id = nId;
  32. }
  33.  
  34.  
  35. Card::Card(QString nQuestion, qint8 nSolutionId, QVector<Answer> nAnswers)
  36. {
  37. question = nQuestion;
  38. solutionId = nSolutionId;
  39. answers = nAnswers;
  40. }
To copy to clipboard, switch view to plain text mode