Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qwaylandtextinputv4_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 QWAYLANDTEXTINPUTV4_P_H
5#define QWAYLANDTEXTINPUTV4_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
19#include <QtWaylandClient/private/qwayland-text-input-unstable-v4-wip.h>
21#include <QLoggingCategory>
22
23struct wl_callback;
24struct wl_callback_listener;
25
27
28Q_DECLARE_LOGGING_CATEGORY(qLcQpaWaylandTextInput)
29
30namespace QtWaylandClient {
31
32class QWaylandDisplay;
33
34class QWaylandTextInputv4 : public QtWayland::zwp_text_input_v4, public QWaylandTextInputInterface
35{
36public:
37 QWaylandTextInputv4(QWaylandDisplay *display, struct ::zwp_text_input_v4 *text_input);
38 ~QWaylandTextInputv4() override;
39
40 void reset() override;
41 void commit() override;
42 void updateState(Qt::InputMethodQueries queries, uint32_t flags) override;
43 // TODO: not supported yet
44 void setCursorInsidePreedit(int cursor) override;
45
46 bool isInputPanelVisible() const override;
47 QRectF keyboardRect() const override;
48
49 QLocale locale() const override;
50 Qt::LayoutDirection inputDirection() const override;
51
52 void enableSurface(::wl_surface *surface) override;
53 void disableSurface(::wl_surface *surface) override;
54
55protected:
56 void zwp_text_input_v4_enter(struct ::wl_surface *surface) override;
57 void zwp_text_input_v4_leave(struct ::wl_surface *surface) override;
58 void zwp_text_input_v4_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override;
59 void zwp_text_input_v4_commit_string(const QString &text) override;
60 void zwp_text_input_v4_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override;
61 void zwp_text_input_v4_done(uint32_t serial) override;
62
63private:
64 QWaylandDisplay *m_display;
66
67 ::wl_surface *m_surface = nullptr; // ### Here for debugging purposes
68
69 struct PreeditInfo {
71 int cursorBegin = 0;
72 int cursorEnd = 0;
73
74 void clear() {
75 text.clear();
76 cursorBegin = 0;
77 cursorEnd = 0;
78 }
79 };
80
81 PreeditInfo m_pendingPreeditString;
82 PreeditInfo m_currentPreeditString;
83 QString m_pendingCommitString;
84 uint m_pendingDeleteBeforeText = 0;
85 uint m_pendingDeleteAfterText = 0;
86
87 QString m_surroundingText;
88 int m_cursor; // cursor position in QString
89 int m_cursorPos; // cursor position in wayland index
90 int m_anchorPos; // anchor position in wayland index
91 uint32_t m_contentHint = 0;
92 uint32_t m_contentPurpose = 0;
93 QRect m_cursorRect;
94
95 uint m_currentSerial = 0;
96
97 bool m_condReselection = false;
98};
99
100}
101
103
104#endif // QWAYLANDTEXTINPUTV4_P_H
\inmodule QtCore\reentrant
Definition qrect.h:483
\inmodule QtCore\reentrant
Definition qrect.h:30
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
void clear()
Clears the contents of the string and makes it null.
Definition qstring.h:1107
void zwp_text_input_v4_leave(struct ::wl_surface *surface) override
void zwp_text_input_v4_enter(struct ::wl_surface *surface) override
void disableSurface(::wl_surface *surface) override
Qt::LayoutDirection inputDirection() const override
void setCursorInsidePreedit(int cursor) override
void zwp_text_input_v4_done(uint32_t serial) override
void zwp_text_input_v4_preedit_string(const QString &text, int32_t cursor_begin, int32_t cursor_end) override
void zwp_text_input_v4_delete_surrounding_text(uint32_t before_length, uint32_t after_length) override
void updateState(Qt::InputMethodQueries queries, uint32_t flags) override
void enableSurface(::wl_surface *surface) override
void zwp_text_input_v4_commit_string(const QString &text) override
b clear()
QString text
QCursor cursor
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
LayoutDirection
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLbitfield flags
unsigned int uint
Definition qtypes.h:29