summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-05-14 11:21:49 +0200
committerJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-08-14 09:24:05 +0200
commitb3f4e5cbe2d1ffa773fa725d34def3fd00341976 (patch)
treebeb65b175bdeac664ddfef3c3a2ae5dd1b76306c /examples
parent72c99dd4463bc41097d3bf68aa21c703ee036b2b (diff)
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>
Diffstat (limited to 'examples')
-rw-r--r--examples/tools/customtype/message.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/tools/customtype/message.cpp b/examples/tools/customtype/message.cpp
index c470ab116e..eb8befc36f 100644
--- a/examples/tools/customtype/message.cpp
+++ b/examples/tools/customtype/message.cpp
@@ -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)