Hi,
first of all, great board.
But i have a problem with understanding the flow of sending/streaming and packing of QImage format.
- We (3 dudes) do a Project: Webcam-Chat
Now we have the captureing (OpenCV), UI and Basic network support.
- Now we stuck in sending and receiving QImage - i found some code here, but all have there differences and we don't know what would be the right and maybe the best way.

First Idea was to send QImage in QDataStream, next was QImage -> QByteArray -> QDataStream, next one QImage -> QBuffer -> QByteArray -> QDataStream

so now we're confused and overcharged.

- So, first Question, what would be the best Way t?!
- What's with the initialization of the Steam, in some code snippets there's:

Example:
Qt Code:
  1. out.setVersion(QDataStream::Qt_4_4);
  2. out << (quint16)0;
  3. out << image;
  4. out.device()->seek(0);
  5. out << (quint16)(ba.size() - sizeof(quint16));
To copy to clipboard, switch view to plain text mode 

in some code there's nothing of this mentioned. Is it, or is it not required for sending QImage?

Most code i found was:

Qt Code:
  1. QImage* image = new QImage("mask.jpg");
  2. QBuffer buffer( &ba );
  3. buffer.open(QIODevice::WriteOnly);
  4.  
  5. QDataStream out(&buffer);
  6.  
  7. out << image;
To copy to clipboard, switch view to plain text mode 

One of my dude's says that this won't work, at least witout the "initialization" (quint16) and so on...


So question is now what procedure would be the best - and how to programm? - example or real code, would be the best

thanks