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
qplatformthemefactory.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
4#include <qpa/qplatformthemefactory_p.h>
5#include <qpa/qplatformthemeplugin.h>
6#include <QDir>
7#include "private/qfactoryloader_p.h"
8#include "qmutex.h"
9
11#include "qplatformtheme.h"
13#include "qdebug.h"
14
16
17using namespace Qt::StringLiterals;
18
19Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, ptLoader,
20 (QPlatformThemeFactoryInterface_iid, "/platformthemes"_L1, Qt::CaseInsensitive))
21
22QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString &platformPluginPath)
23{
24 QStringList paramList = key.split(u':');
25 const QString platform = paramList.takeFirst().toLower();
26 ptLoader->setExtraSearchPath(platformPluginPath);
27 QPlatformTheme *theme = qLoadPlugin<QPlatformTheme, QPlatformThemePlugin>(ptLoader(), platform, paramList);
28 if (theme)
29 theme->d_func()->name = key;
30 return theme;
31}
32
33/*!
34 Returns the list of valid keys, i.e. the keys this factory can
35 create styles for.
36
37 \sa create()
38*/
39QStringList QPlatformThemeFactory::keys(const QString &platformPluginPath)
40{
41 ptLoader->setExtraSearchPath(platformPluginPath);
42 return ptLoader->keyMap().values();
43}
44
45QT_END_NAMESPACE
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 } }))