summaryrefslogtreecommitdiffstats
path: root/examples/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'examples/corelib/tools')
-rw-r--r--examples/corelib/tools/customtype/message.cpp5
-rw-r--r--examples/corelib/tools/customtype/message.h2
2 files changed, 3 insertions, 4 deletions
diff --git a/examples/corelib/tools/customtype/message.cpp b/examples/corelib/tools/customtype/message.cpp
index da44909893..948e323dbf 100644
--- a/examples/corelib/tools/customtype/message.cpp
+++ b/examples/corelib/tools/customtype/message.cpp
@@ -60,8 +60,7 @@ Message::Message(const QString &body, const QStringList &headers)
//! [custom type streaming operator]
QDebug operator<<(QDebug dbg, const Message &message)
{
- const QString body = message.body();
- QList<QStringRef> pieces = body.splitRef(QLatin1String("\r\n"), Qt::SkipEmptyParts);
+ QList<QStringView> pieces = message.body().split(u"\r\n", Qt::SkipEmptyParts);
if (pieces.isEmpty())
dbg.nospace() << "Message()";
else if (pieces.size() == 1)
@@ -73,7 +72,7 @@ QDebug operator<<(QDebug dbg, const Message &message)
//! [custom type streaming operator]
//! [getter functions]
-QString Message::body() const
+QStringView Message::body() const
{
return m_body;
}
diff --git a/examples/corelib/tools/customtype/message.h b/examples/corelib/tools/customtype/message.h
index bc30c45425..acc439b0f6 100644
--- a/examples/corelib/tools/customtype/message.h
+++ b/examples/corelib/tools/customtype/message.h
@@ -65,7 +65,7 @@ public:
Message(const QString &body, const QStringList &headers);
- QString body() const;
+ QStringView body() const;
QStringList headers() const;
private: