title: Is there a shorter way to initialize a QByteArray?
body: <p>In my program I work a lot with serial communication so <code>QByteArray</code> is used very often.</p>
  
  <p>I was wondering if there was a shorter way to initialize a <code>QByteArray</code> with specific bytes than:</p>
  
  <pre><code>const char test_data[] = {
      static_cast&lt;char&gt;(0xB1), static_cast&lt;char&gt;(0xB2),
      0x5, static_cast&lt;char&gt;(0xFF),
      static_cast&lt;char&gt;(0xEE), static_cast&lt;char&gt;(0xEE),
      static_cast&lt;char&gt;(0x0)}; // Note QByteArray should be able to hold 0 byte
  const QCanBusFrame frame = QCanBusFrame(0xA1, QByteArray(test_data));
  </code></pre>
  
  <p>The <code>static_cast&lt;char&gt;</code> is necessary because otherwise C++11 gives an error about narrowing, because the range 0x7F to 0xFF is bigger than a <code>char</code> could fit--but a <code>char</code> is what the <code>QByteArray</code> constructor asks for.</p>
  
  <p>This is the <code>QByteArray</code> constructor being used:</p>
  
  <p><code>QByteArray::QByteArray(const char *data, int size = -1)</code></p>