QByteArray data = "Hello World"; int size = data.length(); // size is now 11
QByteArray data = {0x12, 0x34, 0x56, 0x78}; int size = data.length(); // size is now 4This example creates a QByteArray object containing four bytes and then calls the length() function to retrieve the size of the array. The QByteArray class is part of the Qt Core module.