1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef INPUTMETHOD_P_H
5#define INPUTMETHOD_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQml/qqml.h>
19#include <QtVirtualKeyboard/qvirtualkeyboardabstractinputmethod.h>
20#include <QtCore/private/qglobal_p.h>
21
22QT_BEGIN_NAMESPACE
23namespace QtVirtualKeyboard {
24
25class Q_VIRTUALKEYBOARD_EXPORT InputMethod : public QVirtualKeyboardAbstractInputMethod
26{
27 Q_OBJECT
28 Q_PROPERTY(QVirtualKeyboardInputContext *inputContext READ inputContext CONSTANT)
29 Q_PROPERTY(QVirtualKeyboardInputEngine *inputEngine READ inputEngine CONSTANT)
30 Q_MOC_INCLUDE("qvirtualkeyboardinputcontext.h")
31 QML_NAMED_ELEMENT(InputMethod)
32 QML_ADDED_IN_VERSION(1, 0)
33 QML_EXTRA_VERSION(2, 0)
34
35public:
36 explicit InputMethod(QObject *parent = nullptr);
37 ~InputMethod();
38
39 QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) override;
40 bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) override;
41 bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) override;
42
43 bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) override;
44
45 QList<QVirtualKeyboardSelectionListModel::Type> selectionLists() override;
46 int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type) override;
47 QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index,
48 QVirtualKeyboardSelectionListModel::Role role) override;
49 void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index) override;
50
51 QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> patternRecognitionModes() const override;
52 QVirtualKeyboardTrace *traceBegin(
53 int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode,
54 const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo) override;
55 bool traceEnd(QVirtualKeyboardTrace *trace) override;
56
57 bool reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags) override;
58 bool clickPreeditText(int cursorPosition) override;
59
60 void reset() override;
61 void update() override;
62 void clearInputMode() override;
63};
64
65} // namespace QtVirtualKeyboard
66QT_END_NAMESPACE
67
68#endif // INPUTMETHOD_P_H
69

source code of qtvirtualkeyboard/src/virtualkeyboard/inputmethod_p.h