Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickinputmethod.cpp
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
6
7#include <QtGui/qguiapplication.h>
8
10
11/*!
12 \qmltype InputMethod
13 \inqmlmodule QtQuick
14
15 \brief Provides access to \l QInputMethod for QML applications.
16
17 The InputMethod singleton allows access to application's \l QInputMethod object
18 and all its properties and slots. See the \l QInputMethod documentation for
19 further details.
20*/
21
22QQuickInputMethod::QQuickInputMethod(QObject *parent) : QObject(parent)
23{
24 QInputMethod *inputMethod = QGuiApplication::inputMethod();
25 connect(inputMethod, &QInputMethod::anchorRectangleChanged, this,
26 &QQuickInputMethod::anchorRectangleChanged);
27 connect(inputMethod, &QInputMethod::animatingChanged, this,
28 &QQuickInputMethod::animatingChanged);
29 connect(inputMethod, &QInputMethod::cursorRectangleChanged, this,
30 &QQuickInputMethod::cursorRectangleChanged);
31 connect(inputMethod, &QInputMethod::inputDirectionChanged, this,
32 &QQuickInputMethod::inputDirectionChanged);
33 connect(inputMethod, &QInputMethod::inputItemClipRectangleChanged, this,
34 &QQuickInputMethod::inputItemClipRectangleChanged);
35 connect(inputMethod, &QInputMethod::keyboardRectangleChanged, this,
36 &QQuickInputMethod::keyboardRectangleChanged);
37 connect(inputMethod, &QInputMethod::localeChanged, this, &QQuickInputMethod::localeChanged);
38 connect(inputMethod, &QInputMethod::visibleChanged, this, &QQuickInputMethod::visibleChanged);
39}
40
41void QQuickInputMethod::commit()
42{
43 QGuiApplication::inputMethod()->commit();
44}
45void QQuickInputMethod::hide()
46{
47 QGuiApplication::inputMethod()->hide();
48}
49void QQuickInputMethod::invokeAction(QInputMethod::Action a, int cursorPosition)
50{
51 QGuiApplication::inputMethod()->invokeAction(a, cursorPosition);
52}
53void QQuickInputMethod::reset()
54{
55 QGuiApplication::inputMethod()->reset();
56}
57void QQuickInputMethod::show()
58{
59 QGuiApplication::inputMethod()->show();
60}
61void QQuickInputMethod::update(Qt::InputMethodQueries queries)
62{
63 QGuiApplication::inputMethod()->update(queries);
64}
65
66QRectF QQuickInputMethod::anchorRectangle() const
67{
68 return QGuiApplication::inputMethod()->cursorRectangle();
69}
70QRectF QQuickInputMethod::cursorRectangle() const
71{
72 return QGuiApplication::inputMethod()->cursorRectangle();
73}
74Qt::LayoutDirection QQuickInputMethod::inputDirection() const
75{
76 return QGuiApplication::inputMethod()->inputDirection();
77}
78QRectF QQuickInputMethod::inputItemClipRectangle() const
79{
80 return QGuiApplication::inputMethod()->inputItemClipRectangle();
81}
82
83QRectF QQuickInputMethod::inputItemRectangle() const
84{
85 return QGuiApplication::inputMethod()->inputItemRectangle();
86}
87void QQuickInputMethod::setInputItemRectangle(const QRectF &rect)
88{
89 QGuiApplication::inputMethod()->setInputItemRectangle(rect);
90}
91
92QTransform QQuickInputMethod::inputItemTransform() const
93{
94 return QGuiApplication::inputMethod()->inputItemTransform();
95}
96void QQuickInputMethod::setInputItemTransform(const QTransform &transform)
97{
98 QGuiApplication::inputMethod()->setInputItemTransform(transform);
99}
100
101bool QQuickInputMethod::isAnimating() const
102{
103 return QGuiApplication::inputMethod()->isAnimating();
104}
105
106bool QQuickInputMethod::isVisible() const
107{
108 return QGuiApplication::inputMethod()->isVisible();
109}
110void QQuickInputMethod::setVisible(bool visible)
111{
112 QGuiApplication::inputMethod()->setVisible(visible);
113}
114
115QRectF QQuickInputMethod::keyboardRectangle() const
116{
117 return QGuiApplication::inputMethod()->keyboardRectangle();
118}
119QLocale QQuickInputMethod::locale() const
120{
121 return QGuiApplication::inputMethod()->locale();
122}
123
124QT_END_NAMESPACE
125
126#include "moc_qquickinputmethod_p.cpp"