| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include "plugin.h" |
| 5 | #include <QtVirtualKeyboard/private/platforminputcontext_p.h> |
| 6 | #include <QLoggingCategory> |
| 7 | #if defined(Q_OS_WIN) |
| 8 | #include <qt_windows.h> |
| 9 | #endif |
| 10 | #include <qpa/qplatforminputcontextfactory_p.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | using namespace QtVirtualKeyboard; |
| 15 | |
| 16 | Q_LOGGING_CATEGORY(qlcVirtualKeyboard, "qt.virtualkeyboard") |
| 17 | |
| 18 | static const char pluginName[] = "qtvirtualkeyboard"; |
| 19 | |
| 20 | QStringList QVirtualKeyboardPlugin::keys() const |
| 21 | { |
| 22 | return QStringList(QLatin1String(pluginName)); |
| 23 | } |
| 24 | |
| 25 | QPlatformInputContext *QVirtualKeyboardPlugin::create(const QString &system, const QStringList ¶mList) |
| 26 | { |
| 27 | Q_UNUSED(paramList); |
| 28 | |
| 29 | if (!QPlatformInputContextFactory::requested().contains(str: QLatin1StringView(pluginName))) |
| 30 | return nullptr; |
| 31 | |
| 32 | if (system.compare(s1: system, s2: QLatin1String(pluginName), cs: Qt::CaseInsensitive) != 0) |
| 33 | return nullptr; |
| 34 | |
| 35 | #if defined(Q_OS_WIN) |
| 36 | // QTBUG-93042 |
| 37 | ImmDisableIME(0); |
| 38 | #endif |
| 39 | |
| 40 | PlatformInputContext *platformInputContext = new PlatformInputContext(); |
| 41 | |
| 42 | return platformInputContext; |
| 43 | } |
| 44 | |
| 45 | QT_END_NAMESPACE |
| 46 |
