1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKINPUTMETHOD_P_H
5#define QQUICKINPUTMETHOD_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 <QtCore/qobject.h>
19#include <QtCore/qlocale.h>
20#include <QtCore/qrect.h>
21#include <QtGui/qtransform.h>
22#include <QtGui/qinputmethod.h>
23#include <QtQml/qqml.h>
24
25#include <private/qtquickglobal_p.h>
26
27QT_BEGIN_NAMESPACE
28class Q_QUICK_PRIVATE_EXPORT QQuickInputMethod : public QObject
29{
30 Q_OBJECT
31 QML_NAMED_ELEMENT(InputMethod)
32 QML_ADDED_IN_VERSION(6, 4)
33 QML_SINGLETON
34
35 Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged FINAL)
36 Q_PROPERTY(QRectF anchorRectangle READ anchorRectangle NOTIFY anchorRectangleChanged FINAL)
37 Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged FINAL)
38 Q_PROPERTY(QRectF inputItemClipRectangle READ inputItemClipRectangle NOTIFY
39 inputItemClipRectangleChanged FINAL)
40 Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged FINAL)
41 Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged FINAL)
42 Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged FINAL)
43 Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged FINAL)
44public:
45 explicit QQuickInputMethod(QObject *parent = nullptr);
46
47 QRectF anchorRectangle() const;
48 QRectF cursorRectangle() const;
49 Qt::LayoutDirection inputDirection() const;
50 QRectF inputItemClipRectangle() const;
51
52 QRectF inputItemRectangle() const;
53 void setInputItemRectangle(const QRectF &rect);
54
55 QTransform inputItemTransform() const;
56 void setInputItemTransform(const QTransform &transform);
57
58 bool isAnimating() const;
59
60 bool isVisible() const;
61 void setVisible(bool visible);
62
63 QRectF keyboardRectangle() const;
64 QLocale locale() const;
65Q_SIGNALS:
66 void anchorRectangleChanged();
67 void animatingChanged();
68 void cursorRectangleChanged();
69 void inputDirectionChanged(Qt::LayoutDirection newDirection);
70 void inputItemClipRectangleChanged();
71 void keyboardRectangleChanged();
72 void localeChanged();
73 void visibleChanged();
74
75public Q_SLOTS:
76 void commit();
77 void hide();
78 void invokeAction(QInputMethod::Action a, int cursorPosition);
79 void reset();
80 void show();
81 void update(Qt::InputMethodQueries queries);
82};
83
84QT_END_NAMESPACE
85
86#endif // QQUICKINPUTMETHOD_P_H
87

source code of qtdeclarative/src/quick/util/qquickinputmethod_p.h