Qt 6.x
The Qt SDK
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 QByteArray env = qgetenv("QT_IM_MODULE");
34 return env.isNull() ? QString() : QString::fromLocal8Bit(env);
35}
36
38{
39#if QT_CONFIG(settings)
40 if (!key.isEmpty()) {
41 QStringList paramList = key.split(u':');
42 const QString platform = paramList.takeFirst().toLower();
43
44 QPlatformInputContext *ic = qLoadPlugin<QPlatformInputContext, QPlatformInputContextPlugin>
45 (icLoader(), platform, paramList);
46 if (ic && ic->isValid())
47 return ic;
48
49 delete ic;
50 }
51#else
53#endif
54 return nullptr;
55}
56
58{
59 return create(requested());
60}
61
63
\inmodule QtCore
Definition qbytearray.h:57
bool isNull() const noexcept
Returns true if this byte array is null; otherwise returns false.
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:127
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5788
Combined button and popup list for selecting options.
@ CaseInsensitive
#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()