From 37dde96e5f1cdf8208b5ab9b4d1edacda416adc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Wed, 16 Aug 2023 22:09:57 +0200 Subject: [PATCH] wasm: fix "'QString' is deprecated" warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the _L1 operator from Qt::Literals::StringLiterals Pick-to: 6.6 Change-Id: I3d8dc0b7219879a1907e67b539e047ae7f7aae87 Reviewed-by: Piotr Wierciński Reviewed-by: Mikołaj Boc Reviewed-by: Tor Arne Vestbø --- src/corelib/platform/wasm/qstdweb.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/corelib/platform/wasm/qstdweb.cpp b/src/corelib/platform/wasm/qstdweb.cpp index b5e72128763..05121ba277a 100644 --- a/src/corelib/platform/wasm/qstdweb.cpp +++ b/src/corelib/platform/wasm/qstdweb.cpp @@ -17,6 +17,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::Literals::StringLiterals; + namespace qstdweb { static void usePotentialyUnusedSymbols() @@ -423,7 +425,7 @@ private: QByteArray fileContent(file.size(), Qt::Uninitialized); file.stream(fileContent.data(), [this, itemMimeType, fileContent]() { if (!fileContent.isEmpty()) { - if (itemMimeType.startsWith("image/")) { + if (itemMimeType.startsWith("image/"_L1)) { mimeData->setImageData(imageReader(fileContent)); } else { mimeData->setData(itemMimeType, fileContent.data()); @@ -435,8 +437,8 @@ private: break; } case ItemKind::String: - if (itemMimeType.contains("STRING", Qt::CaseSensitive) - || itemMimeType.contains("TEXT", Qt::CaseSensitive)) { + if (itemMimeType.contains("STRING"_L1, Qt::CaseSensitive) + || itemMimeType.contains("TEXT"_L1, Qt::CaseSensitive)) { break; } QString a; @@ -444,9 +446,9 @@ private: "getData", emscripten::val(itemMimeType.toStdString()))); if (!data.isEmpty()) { - if (itemMimeType == "text/html") + if (itemMimeType == "text/html"_L1) mimeData->setHtml(data); - else if (itemMimeType.isEmpty() || itemMimeType == "text/plain") + else if (itemMimeType.isEmpty() || itemMimeType == "text/plain"_L1) mimeData->setText(data); // the type can be empty else mimeData->setData(itemMimeType, data.toLocal8Bit());