@@ -16,24 +16,6 @@ class InputMethodHandle;
16
16
class InputMethodKeyboardGrab ;
17
17
} // namespace impl
18
18
19
- class KeyboardDirectionKey : public QObject {
20
- Q_OBJECT;
21
- QML_NAMED_ELEMENT (DirectionKey);
22
- QML_SINGLETON;
23
-
24
- public:
25
- enum Enum : quint8 {
26
- UP = static_cast <quint8>(impl::DirectionKey::UP),
27
- DOWN = static_cast <quint8>(impl::DirectionKey::DOWN),
28
- LEFT = static_cast <quint8>(impl::DirectionKey::LEFT),
29
- RIGHT = static_cast <quint8>(impl::DirectionKey::RIGHT),
30
- };
31
- Q_ENUM (Enum);
32
-
33
- Q_INVOKABLE static QString toString (Enum direction);
34
- static Enum fromDirection (impl::DirectionKey direction);
35
- };
36
-
37
19
// / Provides keyboard handling logic for an @@InputMethod$'s grab protocol.
38
20
// / Use @@KeyboardTextEdit$ for a higher level and easier to use version.
39
21
class Keyboard : public QObject {
@@ -53,13 +35,10 @@ class Keyboard: public QObject {
53
35
void returnPress ();
54
36
// / Note that internally Quickshell will release the keyboard when escape is pressed.
55
37
void escapePress ();
56
- void directionPress (KeyboardDirectionKey ::Enum);
38
+ void directionPress (QMLDirectionKey ::Enum);
57
39
void backspacePress ();
58
40
void deletePress ();
59
41
60
- private slots:
61
- void onDirectionPress (impl::DirectionKey direction);
62
-
63
42
private:
64
43
QPointer<impl::InputMethodKeyboardGrab> mKeyboard = nullptr ;
65
44
// QQmlComponent* mSurfaceComponent = nullptr;
@@ -87,12 +66,15 @@ class InputMethod: public QObject {
87
66
Q_PROPERTY (bool hasInput READ hasInput NOTIFY hasInputChanged);
88
67
// / If the input method has grabbed the keyboard
89
68
Q_PROPERTY (bool hasKeyboard READ hasKeyboard NOTIFY hasKeyboardChanged);
90
- // / TODO(cmurtagh-lgtm)
69
+ // / The content_hint of the text input see https://wayland.app/protocols/text-input-unstable-v3#zwp_text_input_v3:enum:content_hint
70
+ Q_PROPERTY (QMLContentHint::Enum contentHint READ contentHint NOTIFY contentHintChanged);
71
+ // / The content_purpose of the text input see https://wayland.app/protocols/text-input-unstable-v3#zwp_text_input_v3:enum:content_purpose
72
+ Q_PROPERTY (QMLContentPurpose::Enum contentPurpose READ contentPurpose NOTIFY contentPurposeChanged);
73
+ // / Clear the preedit text when the keyboard grab is released
91
74
Q_PROPERTY (
92
75
bool clearPreeditOnKeyboardRelease MEMBER mClearPreeditOnKeyboardRelease NOTIFY
93
76
clearPreeditOnKeyboardReleaseChanged
94
77
);
95
- // Q_PROPERTY(QString preedit)
96
78
// / The @@Keyboard$ that will handle the grabbed keyboard.
97
79
// / Use @@KeyboardTextEdit$ for most cases.
98
80
Q_PROPERTY (
@@ -140,23 +122,34 @@ class InputMethod: public QObject {
140
122
// / Releases the grabbed keyboard so it can be used normally.
141
123
Q_INVOKABLE void releaseKeyboard ();
142
124
125
+ Q_INVOKABLE [[nodiscard]] QMLContentHint::Enum contentHint () const ;
126
+ Q_INVOKABLE [[nodiscard]] QMLContentPurpose::Enum contentPurpose () const ;
127
+
143
128
signals:
144
129
void activeChanged ();
145
130
void hasInputChanged ();
146
131
void hasKeyboardChanged ();
147
132
void clearPreeditOnKeyboardReleaseChanged ();
148
133
void keyboardComponentChanged ();
134
+ void contentHintChanged ();
135
+ void contentPurposeChanged ();
149
136
150
137
private slots:
151
138
void onHandleActiveChanged ();
152
139
140
+ void onContentHintChanged (QMLContentHint::Enum contentHint);
141
+ void onContentPurposeChanged (QMLContentPurpose::Enum contentPurpose);
142
+
153
143
private:
154
144
void handleKeyboardActive ();
155
145
156
146
QPointer<impl::InputMethodHandle> handle;
157
147
Keyboard* keyboard = nullptr ;
158
148
QQmlComponent* mKeyboardComponent = nullptr ;
159
149
150
+ QMLContentHint::Enum mContentHint ;
151
+ QMLContentPurpose::Enum mContentPurpose ;
152
+
160
153
bool mClearPreeditOnKeyboardRelease = true ;
161
154
};
162
155
0 commit comments