| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include <qpa/qplatformintegrationfactory_p.h> |
| 5 | #include <qpa/qplatformintegrationplugin.h> |
| 6 | #include "private/qfactoryloader_p.h" |
| 7 | #include "qmutex.h" |
| 8 | #include "qdir.h" |
| 9 | |
| 10 | #include "qguiapplication.h" |
| 11 | #include "qdebug.h" |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | using namespace Qt::StringLiterals; |
| 16 | |
| 17 | Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, piLoader, |
| 18 | (QPlatformIntegrationFactoryInterface_iid, "/platforms"_L1 , Qt::CaseInsensitive)) |
| 19 | |
| 20 | QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platform, const QStringList ¶mList, int &argc, char **argv, const QString &platformPluginPath) |
| 21 | { |
| 22 | piLoader->setExtraSearchPath(platformPluginPath); |
| 23 | return qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(loader: piLoader(), key: platform, args: paramList, args&: argc, args&: argv); |
| 24 | } |
| 25 | |
| 26 | /*! |
| 27 | Returns the list of valid keys, i.e. the keys this factory can |
| 28 | create styles for. |
| 29 | |
| 30 | \sa create() |
| 31 | */ |
| 32 | |
| 33 | QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath) |
| 34 | { |
| 35 | piLoader->setExtraSearchPath(platformPluginPath); |
| 36 | return piLoader->keyMap().values(); |
| 37 | } |
| 38 | |
| 39 | QT_END_NAMESPACE |
| 40 | |
| 41 | |