From 5a2d0cf5feb73dd7ea542ad1c61f1e60c113052e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 18 Oct 2015 16:42:49 +0200 Subject: [PATCH] [docs] QLatin1String: add some guidance as to when to use it Change-Id: I391be8bda3a5cb4873b89b437d2b76b1cd88261f Reviewed-by: Lars Knoll Reviewed-by: Martin Smith Reviewed-by: Mitch Curtis --- src/corelib/tools/qstring.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index f2c44a1de9..39e0f6825e 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -8222,6 +8222,13 @@ QString &QString::setRawData(const QChar *unicode, int size) \snippet code/src_corelib_tools_qstring.cpp 6 + \note If the function you're calling with a QLatin1String + argument isn't actually overloaded to take QLatin1String, the + implicit conversion to QString will trigger a memory allocation, + which is usually what you want to avoid by using QLatin1String + in the first place. In those cases, using QStringLiteral may be + the better option. + \sa QString, QLatin1Char, {QStringLiteral()}{QStringLiteral} */