diff --git a/src/windeployqt/qmlutils.cpp b/src/windeployqt/qmlutils.cpp index 9e8bb09e25eff1ae4b0b4014baf3250135121bdc..52f04406893000c5d5f658a6534910d29809c0df 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 5e1ddc619838a8bfea82e862452d0858363f678c..895c7f1de79f6dce05bda298a7e4f0a4394b5fe7 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);