@@ -16,24 +16,6 @@ class InputMethodHandle;
1616class InputMethodKeyboardGrab ;
1717} // namespace impl
1818
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-
3719// / Provides keyboard handling logic for an @@InputMethod$'s grab protocol.
3820// / Use @@KeyboardTextEdit$ for a higher level and easier to use version.
3921class Keyboard : public QObject {
@@ -53,13 +35,10 @@ class Keyboard: public QObject {
5335 void returnPress ();
5436 // / Note that internally Quickshell will release the keyboard when escape is pressed.
5537 void escapePress ();
56- void directionPress (KeyboardDirectionKey ::Enum);
38+ void directionPress (QMLDirectionKey ::Enum);
5739 void backspacePress ();
5840 void deletePress ();
5941
60- private slots:
61- void onDirectionPress (impl::DirectionKey direction);
62-
6342private:
6443 QPointer<impl::InputMethodKeyboardGrab> mKeyboard = nullptr ;
6544 // QQmlComponent* mSurfaceComponent = nullptr;
@@ -87,12 +66,15 @@ class InputMethod: public QObject {
8766 Q_PROPERTY (bool hasInput READ hasInput NOTIFY hasInputChanged);
8867 // / If the input method has grabbed the keyboard
8968 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
9174 Q_PROPERTY (
9275 bool clearPreeditOnKeyboardRelease MEMBER mClearPreeditOnKeyboardRelease NOTIFY
9376 clearPreeditOnKeyboardReleaseChanged
9477 );
95- // Q_PROPERTY(QString preedit)
9678 // / The @@Keyboard$ that will handle the grabbed keyboard.
9779 // / Use @@KeyboardTextEdit$ for most cases.
9880 Q_PROPERTY (
@@ -140,23 +122,34 @@ class InputMethod: public QObject {
140122 // / Releases the grabbed keyboard so it can be used normally.
141123 Q_INVOKABLE void releaseKeyboard ();
142124
125+ Q_INVOKABLE [[nodiscard]] QMLContentHint::Enum contentHint () const ;
126+ Q_INVOKABLE [[nodiscard]] QMLContentPurpose::Enum contentPurpose () const ;
127+
143128signals:
144129 void activeChanged ();
145130 void hasInputChanged ();
146131 void hasKeyboardChanged ();
147132 void clearPreeditOnKeyboardReleaseChanged ();
148133 void keyboardComponentChanged ();
134+ void contentHintChanged ();
135+ void contentPurposeChanged ();
149136
150137private slots:
151138 void onHandleActiveChanged ();
152139
140+ void onContentHintChanged (QMLContentHint::Enum contentHint);
141+ void onContentPurposeChanged (QMLContentPurpose::Enum contentPurpose);
142+
153143private:
154144 void handleKeyboardActive ();
155145
156146 QPointer<impl::InputMethodHandle> handle;
157147 Keyboard* keyboard = nullptr ;
158148 QQmlComponent* mKeyboardComponent = nullptr ;
159149
150+ QMLContentHint::Enum mContentHint ;
151+ QMLContentPurpose::Enum mContentPurpose ;
152+
160153 bool mClearPreeditOnKeyboardRelease = true ;
161154};
162155
0 commit comments