QByteArray binaryData = "Hello, World"; QByteArray encodedData = binaryData.toBase64(); qDebug() << encodedData; // prints "SGVsbG8sIFdvcmxk"This code takes the string "Hello, World" and converts it to a QByteArray object. Then, the toBase64() method is used to encode the binary data in base64 format. The resulting encoded data is printed to the console using the qDebug() method. The QByteArray class is part of the Qt library, specifically the QtCore module.