QString
QString represents a UTF-16 encoded Unicode string and supports Unicode-aware manipulations. It is implicitly shared and its constructors will allocate memory. Needless to say, it doesn't support SSO. Analogously to QByteArray, if we want to spare these allocations we can use either the fromRawData() member function or the QStringLiteral() macro.
There is an additional string class called QLatin1String which provides a thin wrapper around ASCII-/latin1-encoded char* literals. It is meant as an optimization to avoid the construction of any QString object from string literals, and it defines some basic string-processing methods. However, if a non-const method is called, a copy of string data will be made. Moreover, as it is not a Unicode ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access