Bonjour, je souhaite faire une classe équivalente a IDataInput(ActionScript 3.0) en C++ avec Qt

Voici toutes mes sources

main.cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <DataInput.h>
#include <QtCore>
#include <QApplication>
 
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
 
	bool myBool =  true;
 
	//Création d'un tableau
	QByteArray myByteArray;
 
	// Je rajoute le bool true dans le tableau
	QDataStream myStream(&myByteArray, QIODevice::WriteOnly);
	myStream << myBool;
 
	// J'extrais le bool du tableau
	DataInput dataRead(&myByteArray);
	myBool = dataRead.readBoolean();
 
	// qDebug() retourne false, pourtant j'ai donné un true
	qDebug() << myBool;
 
	return a.exec();
}
 
	bool myBool =  true;
 
	QByteArray myByteArray;
	QDataStream myStream(&myByteArray, QIODevice::WriteOnly);
	myStream << myBool;
 
	DataInput dataRead(&myByteArray);
	qDebug() << dataRead.readBoolean();
 
	return a.exec();
}
DataInput.cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "DataInput.h"
 
DataInput::DataInput(QByteArray *byteArray)
{
	QDataStream m_myStream(*byteArray);
}
 
bool DataInput::readBoolean()
{
	bool myBool;
	m_myStream >> myBool;
	return myBool;
}
DataInput.h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef DATAINPUT_H
#define DATAINPUT_H
 
#include <QByteArray>
#include <QDataStream>
 
class DataInput
{
public:
	DataInput(QByteArray *byteArray);
 
	bool readBoolean();
 
private:
	QDataStream m_myStream;
 
};
 
#endif // DATAINPUT_H
Dans le main, je crée un tableau d'octet et je rajoute un bool qui vaut true.
Seulement quand j'essaye de l'extraire avec ma classe DataInput, je reçois un false.

Je ne comprends pas pourquoi, pourriez-vous me donner un peu d'aide ?
Merci à tous et bonne journée !