QByteArray array;
array.resize(2);
array[0]=0x01;
qDebug()<<"sizeof array[0] is"<<sizeof(array[0]);
qDebug()<<"sizeof array.at(0) is"<<sizeof(array.at(0));
qDebug()<<"sizeof array is"<<sizeof(array);
输出为
sizeof int is 4;
sizeof array[0] is 8;
sizeof array.at(0) is 1;
sizeof array is 4;