Hi, I know how to read a single byte of data because they do not like it, I have a QByteArray data that is supposed to integer pixel values​​, and wanted to chop the QByteArray in these values ​​to form the image, but not how to do that I think my program has so values ​​1234563444 and not know that I take values ​​only assigns 1 to a 2 pixel to another so might please sucesibamente when the value of a 123 the other 45 do not know how I can do that
the value of the pixel gray scale is.
my program is:

void cliente::leeimagen(QByteArray &bytesReceived)

        QBuffer* buffer = new QBuffer(&bytesReceived, this);

             QByteArray array =bytesReceived;
             array = array.mid(24);

        QImage* image2= new QImage(300,240,QImage::Format_RGB888);
        file.open(QIODevice::ReadWrite | QIODevice::Text);
        QTextStream out(&file);
        for(int z=0; z < array.size (); z++){
      int z=0;

        for(int i =0; i <image2->width(); ++i){

               for(int j =0; j < image2->height(); ++j) {

                   QRgb c =image2->pixel(i,j);
                   QByteArray c= array.mid(z,3);
                   int y =c.toInt(); 

                  out <<gray;
        QPixmap* image = new QPixmap(QPixmap::fromImage(*image2));
        emit imageReceived(*image);