Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#include <qpa/qplatforminputcontextfactory_p.h>
5#include <qpa/qplatforminputcontextplugin_p.h>
6#include <qpa/qplatforminputcontext.h>
7#include "private/qfactoryloader_p.h"
8
9#include "qguiapplication.h"
10#include "qdebug.h"
11#include <stdlib.h>
12
14
15using namespace Qt::StringLiterals;
16
17#if QT_CONFIG(settings)
20#endif
21
23{
24#if QT_CONFIG(settings)
25 return icLoader()->keyMap().values();
26#else
27 return QStringList();
28#endif
29}
30
32{
33 QStringList imList;
34 QByteArray env = qgetenv("QT_IM_MODULES");
35
36 if (!env.isEmpty())
37 imList = QString::fromLocal8Bit(env).split(QChar::fromLatin1(';'), Qt::SkipEmptyParts);
38
39 if (!imList.isEmpty())
40 return imList;
41
42 env = qgetenv("QT_IM_MODULE");
43 if (!env.isEmpty())
44 imList = {QString::fromLocal8Bit(env)};
45
46 return imList;
47}
48
50{
51 for (const QString &key : keys) {
52 auto plugin = create(key);
53 if (plugin)
54 return plugin;
55 }
56
57 return nullptr;
58}
59
61{
62#if QT_CONFIG(settings)
63 if (!key.isEmpty()) {
64 QStringList paramList = key.split(u':');
65 const QString platform = paramList.takeFirst().toLower();
66
67 QPlatformInputContext *ic = qLoadPlugin<QPlatformInputContext, QPlatformInputContextPlugin>
68 (icLoader(), platform, paramList);
69 if (ic && ic->isValid())
70 return ic;
71
72 delete ic;
73 }
74#else
76#endif
77 return nullptr;
78}
79
84
86
\inmodule QtCore
Definition qbytearray.h:57
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
Definition qbytearray.h:107
static QPlatformInputContext * create()
The QPlatformInputContext class abstracts the input method dependent data and composing state.
virtual bool isValid() const
Returns input context validity.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5949
QString toLower() const &
Definition qstring.h:435
Combined button and popup list for selecting options.
@ CaseInsensitive
@ SkipEmptyParts
Definition qnamespace.h:128
QList< QString > QStringList
Constructs a string list that contains the given string, str.
#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)
GLuint64 key
#define QPlatformInputContextFactoryInterface_iid
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
#define Q_UNUSED(x)
QT_BEGIN_NAMESPACE Platform platform()
QStringList keys