title: Correct way to losslessly convert to and from std::string and QByteArray
body: <p>What is the correct way to convert losslessly between std::string and QByteArray... mostly for the purpose of handling binary data?</p>
  
  <p>I'm using:</p>
  
  <pre><code>QByteArray qba = QString::fromStdString(stdString).toAscii();
  </code></pre>
  
  <p>and</p>
  
  <pre><code>QString(qba).toStdString();
  </code></pre>
  
  <p>but I wanted to check whether this is actually correct.</p>