The following works for me:
QByteArray baData;
baData.fill(0, 80);
QString str = "Hello World";
baData.insert(0, str.toLocal8Bit());
baData.resize(80);
Basically how it works is, you fill the QByteArray
with 80 bytes of 0s, insert your data in the beginning and then resize it back to 80 bytes.