QChar c = QChar::fromLatin1('A'); char latin1Char = c.toLatin1();
QString str = "Hello World!"; QByteArray byteArray = str.toLatin1();In this example, we first create a QString object with the string "Hello World!". We then use the toLatin1 method to convert this string to a QByteArray, which contains the Latin-1 representation of the original string. The QChar class and its methods are part of the Qt Core module, which is included in the Qt library. Developers can use Qt to build cross-platform applications for desktop, mobile, and embedded systems.