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
13QT_BEGIN_NAMESPACE
14
15using namespace Qt::StringLiterals;
16
17Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, piLoader,
18 (QPlatformIntegrationFactoryInterface_iid, "/platforms"_L1, Qt::CaseInsensitive))
19
20QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platform, const QStringList &paramList, 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
33QStringList QPlatformIntegrationFactory::keys(const QString &platformPluginPath)
34{
35 piLoader->setExtraSearchPath(platformPluginPath);
36 return piLoader->keyMap().values();
37}
38
39QT_END_NAMESPACE
40
41

source code of qtbase/src/gui/kernel/qplatformintegrationfactory.cpp