1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef PLATFORMINPUTCONTEXT_P_H
5#define PLATFORMINPUTCONTEXT_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 <qevent.h>
19#include <qpa/qplatforminputcontext.h>
20#include <QPointer>
21#include <QLocale>
22#include <QtVirtualKeyboard/private/inputselectionhandle_p.h>
23#include <QtVirtualKeyboard/private/desktopinputselectioncontrol_p.h>
24
25QT_BEGIN_NAMESPACE
26
27class QVirtualKeyboardInputContext;
28class QVirtualKeyboardInputContextPrivate;
29
30namespace QtVirtualKeyboard {
31
32class AbstractInputPanel;
33
34class Q_VIRTUALKEYBOARD_EXPORT PlatformInputContext : public QPlatformInputContext
35{
36 Q_OBJECT
37public:
38 explicit PlatformInputContext();
39 ~PlatformInputContext();
40
41 bool isValid() const override;
42
43 void reset() override;
44 void commit() override;
45 void update(Qt::InputMethodQueries queries) override;
46 void invokeAction(QInputMethod::Action action, int cursorPosition) override;
47 QRectF keyboardRect() const override;
48
49 bool isAnimating() const override;
50
51 void showInputPanel() override;
52 void hideInputPanel() override;
53 bool isInputPanelVisible() const override;
54
55 QLocale locale() const override;
56 void setLocale(QLocale locale);
57 Qt::LayoutDirection inputDirection() const override;
58 void setInputDirection(Qt::LayoutDirection direction);
59
60 QObject *focusObject();
61 void setFocusObject(QObject *object) override;
62
63 QVirtualKeyboardInputContext *inputContext() const;
64
65 bool eventFilter(QObject *object, QEvent *event) override;
66
67signals:
68 void focusObjectChanged();
69
70protected:
71 void sendEvent(QEvent *event);
72 void sendKeyEvent(QKeyEvent *event);
73 QVariant inputMethodQuery(Qt::InputMethodQuery query);
74 void setInputContext(QVirtualKeyboardInputContext *context);
75 bool evaluateInputPanelVisible() const;
76
77private slots:
78 void keyboardRectangleChanged();
79 void updateInputPanelVisible();
80
81private:
82 friend class ::QVirtualKeyboardInputContext;
83 friend class ::QVirtualKeyboardInputContextPrivate;
84 QPointer<QVirtualKeyboardInputContext> m_inputContext;
85 QPointer<AbstractInputPanel> m_inputPanel;
86 QPointer<DesktopInputSelectionControl> m_selectionControl;
87 QPointer<QObject> m_focusObject;
88 QLocale m_locale;
89 Qt::LayoutDirection m_inputDirection;
90 QEvent *m_filterEvent;
91 bool m_visible;
92 bool m_desktopModeDisabled;
93};
94
95} // namespace QtVirtualKeyboard
96QT_END_NAMESPACE
97
98#endif
99

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