QFactoryLoader: load extraSearchPath first

Since `QT_QPA_PLATFORM_PLUGIN_PATH` or `-platformpluginpath`
 specifies the path to platform plugins, `extraSearchPath`
 should be loaded first.

Pick-to: 6.8 6.9
Change-Id: I2e62fbf2021250ca864c669a7bbd7d56acd67d1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Mike Chen 2024-12-19 17:25:17 +08:00
parent 7a7804d4b4
commit 457580936d

View File

@ -398,6 +398,9 @@ void QFactoryLoader::update()
#ifdef QT_SHARED #ifdef QT_SHARED
Q_D(QFactoryLoader); Q_D(QFactoryLoader);
if (!d->extraSearchPath.isEmpty())
d->updateSinglePath(d->extraSearchPath);
const QStringList paths = QCoreApplication::libraryPaths(); const QStringList paths = QCoreApplication::libraryPaths();
for (const QString &pluginDir : paths) { for (const QString &pluginDir : paths) {
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
@ -405,11 +408,8 @@ void QFactoryLoader::update()
#else #else
QString path = pluginDir + d->suffix; QString path = pluginDir + d->suffix;
#endif #endif
d->updateSinglePath(path); d->updateSinglePath(path);
} }
if (!d->extraSearchPath.isEmpty())
d->updateSinglePath(d->extraSearchPath);
#else #else
Q_D(QFactoryLoader); Q_D(QFactoryLoader);
qCDebug(lcFactoryLoader) << "ignoring" << d->iid qCDebug(lcFactoryLoader) << "ignoring" << d->iid