diff options
| author | Olivier De Cannière <olivier.decanniere@qt.io> | 2025-10-22 11:32:34 +0200 |
|---|---|---|
| committer | Olivier De Cannière <olivier.decanniere@qt.io> | 2025-10-22 22:12:44 +0200 |
| commit | baaab2e4687e093c7fdd3e5049002b7d7e70ac18 (patch) | |
| tree | 854e3d50a21c55547aad01f576cbeddf3621732e /src/qmlcompiler/qqmljsloggingutils.cpp | |
| parent | a9357708967291a5e46359127b454fe94da59438 (diff) | |
Compiler: Avoid generating duplicate settings names
The two computations may result in the same string.
Insert the second one only if it is differnt.
Amends c4455f1771483c8ed63d27454242f19b28b524b0
Pick-to: 6.10
Change-Id: I0c4df0cf6bb5bba2c1cf6c50b8a7f105718b85ee
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsloggingutils.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsloggingutils.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qmlcompiler/qqmljsloggingutils.cpp b/src/qmlcompiler/qqmljsloggingutils.cpp index 06298b303b..b7308e1c74 100644 --- a/src/qmlcompiler/qqmljsloggingutils.cpp +++ b/src/qmlcompiler/qqmljsloggingutils.cpp @@ -166,8 +166,10 @@ QString levelToString(const QQmlJS::LoggerCategory &category) static QStringList settingsNamesForCategory(const LoggerCategory &category) { const QString name = category.settingsName(); - const QStringList result{ QStringLiteral("Warnings/") += name, - QStringLiteral("Warnings/") += name.sliced(name.indexOf(u'.') + 1) }; + QStringList result{ QStringLiteral("Warnings/") + name }; + const QString sliced = "Warnings/"_L1 + name.sliced(name.indexOf(u'.') + 1); + if (sliced != result.last()) + result.append(sliced); return result; } |
