From dde8d5e3a006c87b7a3f18733ba255d6354fcd37 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 15 Oct 2015 14:47:18 +0200 Subject: QTextStream: add missing op<<(QStringRef) It simply is missing. We could wait for QStringView to come around, but I need this function in uic _now_, so let's add it. [ChangeLog][QtCore][QTextStream] Can now stream QStringRef without converting to a QString first. Change-Id: Idd178e0ba8a89c025f4533d46de912cbdb3883d5 Reviewed-by: Lars Knoll --- src/corelib/io/qtextstream.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/corelib/io/qtextstream.cpp') diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 5d82453270..64222c2212 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -2519,6 +2519,21 @@ QTextStream &QTextStream::operator<<(QLatin1String string) return *this; } +/*! + \since 5.6 + \overload + + Writes \a string to the stream, and returns a reference to the + QTextStream. +*/ +QTextStream &QTextStream::operator<<(const QStringRef &string) +{ + Q_D(QTextStream); + CHECK_VALID_STREAM(*this); + d->putString(string.data(), string.size()); + return *this; +} + /*! \overload -- cgit v1.2.3