title: Convert QByteArray to std::vector<unsigned char>
body: <p>I tried to convert <code>QByteArray</code> to <code>std::vector&lt;unsigned char&gt;</code> using this code:</p>
  
  <pre><code>unsigned char* buffer = (unsigned char*)byteArrayBuffer.constData();
  std::vector&lt;unsigned char&gt;::size_type size = strlen((const char*)buffer);
  std::vector&lt;unsigned char&gt; bufferToCompress(buffer, buffer + size);
  </code></pre>
  
  <p>but, assuming that <code>byteArrayBuffer</code> is a <code>QByteArray</code> filled with data, I think it doesn't work well on line <code>unsigned char* buffer = (unsigned char*)byteArrayBuffer.constData();</code> because <code>byteArrayBuffer.size()</code> returns a different value than <code>bufferToCompress.size()</code>. </p>
  
  <p>How can I get it working?</p>