1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef SHADOWINPUTCONTEXT_P_H
5#define SHADOWINPUTCONTEXT_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 <QObject>
19#include <QPointer>
20#include <QMetaType>
21#include <QRectF>
22#include <QtQml/qqml.h>
23#include <QtVirtualKeyboard/qvirtualkeyboard_global.h>
24#include <QtCore/private/qglobal_p.h>
25
26QT_BEGIN_NAMESPACE
27
28class QVirtualKeyboardInputContext;
29class QVirtualKeyboardInputContextPrivate;
30
31namespace QtVirtualKeyboard {
32
33class ShadowInputContextPrivate;
34
35class Q_VIRTUALKEYBOARD_EXPORT ShadowInputContext : public QObject
36{
37 Q_OBJECT
38 Q_DISABLE_COPY(ShadowInputContext)
39 Q_DECLARE_PRIVATE(ShadowInputContext)
40 Q_PROPERTY(QObject *inputItem READ inputItem WRITE setInputItem NOTIFY inputItemChanged)
41 Q_PROPERTY(QRectF anchorRectangle READ anchorRectangle NOTIFY anchorRectangleChanged)
42 Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
43 Q_PROPERTY(bool anchorRectIntersectsClipRect READ anchorRectIntersectsClipRect NOTIFY anchorRectIntersectsClipRectChanged)
44 Q_PROPERTY(bool cursorRectIntersectsClipRect READ cursorRectIntersectsClipRect NOTIFY cursorRectIntersectsClipRectChanged)
45 Q_PROPERTY(bool selectionControlVisible READ selectionControlVisible NOTIFY selectionControlVisibleChanged)
46 QML_NAMED_ELEMENT(ShadowInputContext)
47 QML_UNCREATABLE("ShadowInputContext is only available via InputContext.priv.shadow")
48 QML_ADDED_IN_VERSION(2, 0)
49
50 explicit ShadowInputContext(QObject *parent = nullptr);
51
52 void setInputContext(QVirtualKeyboardInputContext *inputContext);
53
54public:
55 QObject *inputItem() const;
56 void setInputItem(QObject *inputItem);
57 QRectF anchorRectangle() const;
58 QRectF cursorRectangle() const;
59 bool anchorRectIntersectsClipRect() const;
60 bool cursorRectIntersectsClipRect() const;
61 bool selectionControlVisible() const;
62
63 Q_INVOKABLE void setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos);
64 Q_INVOKABLE void updateSelectionProperties();
65
66signals:
67 void inputItemChanged();
68 void anchorRectangleChanged();
69 void cursorRectangleChanged();
70 void anchorRectIntersectsClipRectChanged();
71 void cursorRectIntersectsClipRectChanged();
72 void selectionControlVisibleChanged();
73
74private:
75 void update(Qt::InputMethodQueries queries);
76 QVariant queryFocusObject(Qt::InputMethodQuery query, QVariant argument);
77
78private:
79 friend class ::QVirtualKeyboardInputContextPrivate;
80 friend class ::QVirtualKeyboardInputContext;
81};
82
83} // namespace QtVirtualKeyboard
84QT_END_NAMESPACE
85
86#endif // SHADOWINPUTCONTEXT_P_H
87

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

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