1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QVIRTUALKEYBOARDABSTRACTINPUTMETHOD_H |
5 | #define QVIRTUALKEYBOARDABSTRACTINPUTMETHOD_H |
6 | |
7 | #include <QtQml/qqml.h> |
8 | #include <QtVirtualKeyboard/qvirtualkeyboardinputengine.h> |
9 | #include <QtVirtualKeyboard/qvirtualkeyboardselectionlistmodel.h> |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | class QVirtualKeyboardAbstractInputMethodPrivate; |
14 | |
15 | class Q_VIRTUALKEYBOARD_EXPORT QVirtualKeyboardAbstractInputMethod : public QObject |
16 | { |
17 | Q_OBJECT |
18 | Q_DECLARE_PRIVATE(QVirtualKeyboardAbstractInputMethod) |
19 | QML_ANONYMOUS |
20 | QML_ADDED_IN_VERSION(1, 0) |
21 | QML_EXTRA_VERSION(2, 0) |
22 | |
23 | protected: |
24 | QVirtualKeyboardAbstractInputMethod(QVirtualKeyboardAbstractInputMethodPrivate &dd, QObject *parent = nullptr); |
25 | |
26 | public: |
27 | explicit QVirtualKeyboardAbstractInputMethod(QObject *parent = nullptr); |
28 | ~QVirtualKeyboardAbstractInputMethod(); |
29 | |
30 | QVirtualKeyboardInputContext *inputContext() const; |
31 | QVirtualKeyboardInputEngine *inputEngine() const; |
32 | |
33 | virtual QList<QVirtualKeyboardInputEngine::InputMode> inputModes(const QString &locale) = 0; |
34 | virtual bool setInputMode(const QString &locale, QVirtualKeyboardInputEngine::InputMode inputMode) = 0; |
35 | virtual bool setTextCase(QVirtualKeyboardInputEngine::TextCase textCase) = 0; |
36 | |
37 | virtual bool keyEvent(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers) = 0; |
38 | |
39 | virtual QList<QVirtualKeyboardSelectionListModel::Type> selectionLists(); |
40 | virtual int selectionListItemCount(QVirtualKeyboardSelectionListModel::Type type); |
41 | virtual QVariant selectionListData(QVirtualKeyboardSelectionListModel::Type type, int index, QVirtualKeyboardSelectionListModel::Role role); |
42 | virtual void selectionListItemSelected(QVirtualKeyboardSelectionListModel::Type type, int index); |
43 | virtual bool selectionListRemoveItem(QVirtualKeyboardSelectionListModel::Type type, int index); |
44 | |
45 | virtual QList<QVirtualKeyboardInputEngine::PatternRecognitionMode> patternRecognitionModes() const; |
46 | virtual QVirtualKeyboardTrace *traceBegin( |
47 | int traceId, QVirtualKeyboardInputEngine::PatternRecognitionMode patternRecognitionMode, |
48 | const QVariantMap &traceCaptureDeviceInfo, const QVariantMap &traceScreenInfo); |
49 | virtual bool traceEnd(QVirtualKeyboardTrace *trace); |
50 | |
51 | virtual bool reselect(int cursorPosition, const QVirtualKeyboardInputEngine::ReselectFlags &reselectFlags); |
52 | virtual bool clickPreeditText(int cursorPosition); |
53 | |
54 | Q_SIGNALS: |
55 | void selectionListChanged(QVirtualKeyboardSelectionListModel::Type type); |
56 | void selectionListActiveItemChanged(QVirtualKeyboardSelectionListModel::Type type, int index); |
57 | void selectionListsChanged(); |
58 | |
59 | public Q_SLOTS: |
60 | virtual void reset(); |
61 | virtual void update(); |
62 | Q_REVISION(6, 1) virtual void clearInputMode(); |
63 | |
64 | private: |
65 | void setInputEngine(QVirtualKeyboardInputEngine *inputEngine); |
66 | |
67 | friend class QVirtualKeyboardInputEngine; |
68 | }; |
69 | |
70 | QT_END_NAMESPACE |
71 | |
72 | #endif |
73 | |