const ushort utf16_arr[] = {0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x0020, 0x004B, 0x0069, 0x0074, 0x0074, 0x0079, 0x0021, 0x0000}; QString utf16_str = QString::fromUtf16(utf16_arr);
QByteArray utf16_bytes = utf16_str.toUtf16();This converts the QString object back to a UTF-16 encoded QByteArray, by calling the toUtf16() function. In both examples, the package library used is the Qt framework library, which provides a comprehensive set of tools for developing cross-platform graphical user interfaces (GUI), as well as other software applications.