From 181e45964dda281c456db3d3315d53782f918962 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@qt.io> Date: Mon, 17 Jul 2017 13:18:10 +0200 Subject: [PATCH] windeployqt: Fall back comparing names of QML modules when their class name is empty QtWebEngine and some other modules have empty class names, so they are dropped when concatenating QML imports. Task-number: QTBUG-61957 Change-Id: I06ccf8ab54b2d3ffba04f15746722f5b3596d5d9 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> --- src/windeployqt/qmlutils.cpp | 16 ++++++---------- src/windeployqt/qmlutils.h | 2 ++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/windeployqt/qmlutils.cpp b/src/windeployqt/qmlutils.cpp index 9e8bb09e2..52f044068 100644 --- a/src/windeployqt/qmlutils.cpp +++ b/src/windeployqt/qmlutils.cpp @@ -39,6 +39,11 @@ QT_BEGIN_NAMESPACE +bool operator==(const QmlImportScanResult::Module &m1, const QmlImportScanResult::Module &m2) +{ + return m1.className.isEmpty() ? m1.name == m2.name : m1.className == m2.className; +} + // Return install path (cp -r semantics) QString QmlImportScanResult::Module::installPath(const QString &root) const { @@ -153,19 +158,10 @@ QmlImportScanResult runQmlImportScanner(const QString &directory, const QString return result; } -static inline bool contains(const QList<QmlImportScanResult::Module> &modules, const QString &className) -{ - for (const QmlImportScanResult::Module &m : modules) { - if (m.className == className) - return true; - } - return false; -} - void QmlImportScanResult::append(const QmlImportScanResult &other) { for (const QmlImportScanResult::Module &module : other.modules) { - if (!contains(modules, module.className)) + if (std::find(modules.cbegin(), modules.cend(), module) == modules.cend()) modules.append(module); } for (const QString &plugin : other.plugins) { diff --git a/src/windeployqt/qmlutils.h b/src/windeployqt/qmlutils.h index 5e1ddc619..895c7f1de 100644 --- a/src/windeployqt/qmlutils.h +++ b/src/windeployqt/qmlutils.h @@ -55,6 +55,8 @@ struct QmlImportScanResult { QStringList plugins; }; +bool operator==(const QmlImportScanResult::Module &m1, const QmlImportScanResult::Module &m2); + QmlImportScanResult runQmlImportScanner(const QString &directory, const QString &qmlImportPath, bool usesWidgets, int platform, DebugMatchMode debugMatchMode, QString *errorMessage); -- GitLab