Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qplatforminputcontextfactory.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
5
#
include
<
qpa
/
qplatforminputcontextfactory_p
.
h
>
6
#
include
<
qpa
/
qplatforminputcontextplugin_p
.
h
>
7
#
include
<
qpa
/
qplatforminputcontext
.
h
>
8
#
include
"private/qfactoryloader_p.h"
9
10
#
include
"qguiapplication.h"
11
#
include
"qdebug.h"
12
#
include
<
stdlib
.
h
>
13
14
QT_BEGIN_NAMESPACE
15
16
using
namespace
Qt::StringLiterals;
17
18
#
if
QT_CONFIG
(
settings
)
19
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, icLoader,
20
(QPlatformInputContextFactoryInterface_iid,
"/platforminputcontexts"_L1
, Qt::CaseInsensitive))
21
#
endif
22
23
QStringList QPlatformInputContextFactory::keys()
24
{
25
#
if
QT_CONFIG
(
settings
)
26
return
icLoader()->keyMap().values();
27
#
else
28
return
QStringList();
29
#
endif
30
}
31
32
QStringList QPlatformInputContextFactory::requested()
33
{
34
QStringList imList;
35
QByteArray env = qgetenv(
"QT_IM_MODULES"
);
36
37
if
(!env.isEmpty())
38
imList = QString::fromLocal8Bit(env).split(QChar::fromLatin1(
';'
), Qt::SkipEmptyParts);
39
40
if
(!imList.isEmpty())
41
return
imList;
42
43
env = qgetenv(
"QT_IM_MODULE"
);
44
if
(!env.isEmpty())
45
imList = {QString::fromLocal8Bit(env)};
46
47
return
imList;
48
}
49
50
QPlatformInputContext *QPlatformInputContextFactory::create(
const
QStringList& keys)
51
{
52
for
(
const
QString &key : keys) {
53
auto
plugin = create(key);
54
if
(plugin)
55
return
plugin;
56
}
57
58
return
nullptr
;
59
}
60
61
QPlatformInputContext *QPlatformInputContextFactory::create(
const
QString& key)
62
{
63
#
if
QT_CONFIG
(
settings
)
64
if
(!key.isEmpty()) {
65
QStringList paramList = key.split(u':');
66
const
QString platform = paramList.takeFirst().toLower();
67
68
QPlatformInputContext *ic = qLoadPlugin<QPlatformInputContext, QPlatformInputContextPlugin>
69
(icLoader(), platform, paramList);
70
if
(ic && ic->isValid())
71
return
ic;
72
73
delete
ic;
74
}
75
#
else
76
Q_UNUSED(key);
77
#
endif
78
return
nullptr
;
79
}
80
81
QPlatformInputContext *QPlatformInputContextFactory::create()
82
{
83
return
create(requested());
84
}
85
86
QT_END_NAMESPACE
qtbase
src
gui
kernel
qplatforminputcontextfactory.cpp
Generated on
for Qt by
1.18.0