1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29
30#ifndef PLATFORMINPUTCONTEXT_P_H
31#define PLATFORMINPUTCONTEXT_P_H
32
33//
34// W A R N I N G
35// -------------
36//
37// This file is not part of the Qt API. It exists purely as an
38// implementation detail. This header file may change from version to
39// version without notice, or even be removed.
40//
41// We mean it.
42//
43
44#include <qevent.h>
45#include <qpa/qplatforminputcontext.h>
46#include <QPointer>
47#include <QLocale>
48#include <QtVirtualKeyboard/private/inputselectionhandle_p.h>
49#include <QtVirtualKeyboard/private/desktopinputselectioncontrol_p.h>
50
51QT_BEGIN_NAMESPACE
52
53class QVirtualKeyboardInputContext;
54class QVirtualKeyboardInputContextPrivate;
55
56namespace QtVirtualKeyboard {
57
58class AbstractInputPanel;
59
60class QVIRTUALKEYBOARD_EXPORT PlatformInputContext : public QPlatformInputContext
61{
62 Q_OBJECT
63public:
64 explicit PlatformInputContext();
65 ~PlatformInputContext();
66
67 bool isValid() const override;
68
69 void reset() override;
70 void commit() override;
71 void update(Qt::InputMethodQueries queries) override;
72 void invokeAction(QInputMethod::Action action, int cursorPosition) override;
73 QRectF keyboardRect() const override;
74
75 bool isAnimating() const override;
76
77 void showInputPanel() override;
78 void hideInputPanel() override;
79 bool isInputPanelVisible() const override;
80
81 QLocale locale() const override;
82 void setLocale(QLocale locale);
83 Qt::LayoutDirection inputDirection() const override;
84 void setInputDirection(Qt::LayoutDirection direction);
85
86 QObject *focusObject();
87 void setFocusObject(QObject *object) override;
88
89 QVirtualKeyboardInputContext *inputContext() const;
90
91 bool eventFilter(QObject *object, QEvent *event) override;
92
93 void setInputMethods(const QStringList &inputMethods);
94 QStringList inputMethods() const;
95
96signals:
97 void focusObjectChanged();
98
99protected:
100 void sendEvent(QEvent *event);
101 void sendKeyEvent(QKeyEvent *event);
102 QVariant inputMethodQuery(Qt::InputMethodQuery query);
103 void setInputContext(QVirtualKeyboardInputContext *context);
104 bool evaluateInputPanelVisible() const;
105
106private slots:
107 void keyboardRectangleChanged();
108 void updateInputPanelVisible();
109
110private:
111 friend class ::QVirtualKeyboardInputContext;
112 friend class ::QVirtualKeyboardInputContextPrivate;
113 QPointer<QVirtualKeyboardInputContext> m_inputContext;
114 QStringList m_inputMethods;
115 QPointer<AbstractInputPanel> m_inputPanel;
116 QPointer<DesktopInputSelectionControl> m_selectionControl;
117 QPointer<QObject> m_focusObject;
118 QLocale m_locale;
119 Qt::LayoutDirection m_inputDirection;
120 QEvent *m_filterEvent;
121 bool m_visible;
122 bool m_desktopModeDisabled;
123};
124
125} // namespace QtVirtualKeyboard
126QT_END_NAMESPACE
127
128#endif
129

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