xref: /OK3568_Linux_fs/app/forlinx/DWKeyboard/include/platforminputcontext.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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_H
31 #define PLATFORMINPUTCONTEXT_H
32 
33 #include "dwkeyboard_global.h"
34 #include <qevent.h>
35 #include <QPointer>
36 #include <QLocale>
37 
38 namespace QtVirtualKeyboard {
39 
40 class InputContext;
41 class AbstractInputPanel;
42 class DWKEYBOARDSHARED_EXPORT PlatformInputContext : public QObject
43 {
44     Q_OBJECT
45 public:
46     explicit PlatformInputContext();
47     ~PlatformInputContext();
48 
49     virtual bool isValid() const;
50 
51     virtual void reset();
52     virtual void commit();
53     virtual void update(Qt::InputMethodQueries queries);
54     virtual QRectF keyboardRect() const;
55 
56     virtual bool isAnimating() const;
57 
58     virtual void showInputPanel();
59     virtual void hideInputPanel();
60     virtual bool isInputPanelVisible() const;
61 
62     virtual QLocale locale() const;
63     void setLocale(QLocale locale);
64     virtual Qt::LayoutDirection inputDirection() const;
65     void setInputDirection(Qt::LayoutDirection direction);
66 
67     QObject *focusObject();
68     virtual void setFocusObject(QObject *object);
69 
70     InputContext *inputContext() const;
71 
72     virtual bool eventFilter(QObject *object, QEvent *event);
73 signals:
74     void focusObjectChanged();
75 protected:
76     void sendEvent(QEvent *event);
77     void sendKeyEvent(QKeyEvent *event);
78     QVariant inputMethodQuery(Qt::InputMethodQuery query);
79     void setInputContext(InputContext *context);
80 public slots:
81     void FocusIn(QObject* obj, QPoint pos);
82     void FocusOut(QObject* obj);
83 private slots:
84     void keyboardRectangleChanged();
85     void updateInputPanelVisible();
86 	bool virtualKeyPress(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool isAutoRepeat);// 控件点击
87 	bool virtualKeyRelease(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);// 控件点击
88 private:
89     friend class InputContext;
90     QPointer<InputContext> m_inputContext;
91     QPointer<AbstractInputPanel> m_inputPanel;
92     QPointer<QObject> m_focusObject;
93     QLocale m_locale;
94     Qt::LayoutDirection m_inputDirection;
95     QEvent *m_filterEvent;
96     bool m_visible;
97     QPoint m_show_pos;
98 };
99 
100 } // namespace QtVirtualKeyboard
101 
102 #endif
103