Use QString::splitRef in customtype example

There is no need to allocate all these strings

Change-Id: I398e1cc05bd3ad24df067a967a5e24fbc6d452ce
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
bb10
Jędrzej Nowacki 2014-05-14 11:21:49 +02:00
parent 72c99dd446
commit b3f4e5cbe2
1 changed files with 2 additions and 1 deletions

View File

@ -65,7 +65,8 @@ Message::Message(const QString &body, const QStringList &headers)
//! [custom type streaming operator]
QDebug operator<<(QDebug dbg, const Message &message)
{
QStringList pieces = message.body().split("\r\n", QString::SkipEmptyParts);
const QString body = message.body();
QVector<QStringRef> pieces = body.splitRef("\r\n", QString::SkipEmptyParts);
if (pieces.isEmpty())
dbg.nospace() << "Message()";
else if (pieces.size() == 1)