Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgenericpluginfactory.cpp
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
6
8#include "private/qfactoryloader_p.h"
10#include "qdebug.h"
11
13
14using namespace Qt::StringLiterals;
15
16Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, gpLoader,
17 (QGenericPluginFactoryInterface_iid, "/generic"_L1, Qt::CaseInsensitive))
18
19/*!
20 \class QGenericPluginFactory
21 \ingroup plugins
22 \inmodule QtGui
23
24 \brief The QGenericPluginFactory class creates plugin drivers.
25
26 \sa QGenericPlugin
27*/
28
29/*!
30 Creates the driver specified by \a key, using the given \a specification.
31
32 Note that the keys are case-insensitive.
33
34 \sa keys()
35*/
36QObject *QGenericPluginFactory::create(const QString& key, const QString &specification)
37{
38 return qLoadPlugin<QObject, QGenericPlugin>(gpLoader(), key.toLower(), specification);
39}
40
41/*!
42 Returns the list of valid keys, i.e. the available mouse drivers.
43
44 \sa create()
45*/
46QStringList QGenericPluginFactory::keys()
47{
48 QStringList list;
49
50 typedef QMultiMap<int, QString> PluginKeyMap;
51 typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
52
53 const PluginKeyMap keyMap = gpLoader()->keyMap();
54 const PluginKeyMapConstIterator cend = keyMap.constEnd();
55 for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it)
56 if (!list.contains(it.value()))
57 list += it.value();
58 return list;
59}
60
61QT_END_NAMESPACE
Combined button and popup list for selecting options.
#define QGenericPluginFactoryInterface_iid
Q_GLOBAL_STATIC_WITH_ARGS(PermissionStatusHash, g_permissionStatusHash,({ { qMetaTypeId< QCameraPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QMicrophonePermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QBluetoothPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QContactsPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QCalendarPermission >(), Qt::PermissionStatus::Undetermined }, { qMetaTypeId< QLocationPermission >(), Qt::PermissionStatus::Undetermined } }))