diff options
author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2011-04-27 15:53:28 +0200 |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2011-05-10 12:54:50 +0200 |
commit | e8ac3549c5000777f9dc15ce06f57e690547d155 (patch) | |
tree | 8852112c77431df808d6670be52d1d1e15d5399f /src/gui/painting/qpainterpath.cpp | |
parent | b9f6b156c65d4ab0066d9d78fe7d499f1c5c4c49 (diff) |
Added QStringRef::toLatin1 and QStringRef::toUtf8
These helper functions make it convenient to avoid making an unnecessary
copy of the string before converting it to a QByteArray. The current
most obvious way to do this would be:
// QStringRef text
QByteArray latin1 = text.toString().toLatin1();
Though the copy can also be avoided by doing:
const QString textData =
QString::fromRawData(text.unicode(), text.size());
QByteArray latin1 = textData.toLatin1();
Now the faster method can be achieved using the new obvious way:
QByteArray latin1 = text.toLatin1();
Reviewed-by: Thiago Macieira
Reviewed-by: Robin Burchell
(cherry picked from commit feabda665de62a0f6a82d831b45926697f30b45b)
Diffstat (limited to 'src/gui/painting/qpainterpath.cpp')
0 files changed, 0 insertions, 0 deletions