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
qqnxinputcontext_imf.h
Go to the documentation of this file.
1// Copyright (C) 2013 BlackBerry Limited. All rights reserved.
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 QQNXINPUTCONTEXT_H
5#define QQNXINPUTCONTEXT_H
6
7#include <qpa/qplatforminputcontext.h>
9
10#include <QtCore/QLocale>
11#include <QtCore/QMetaType>
12#include <QtCore/QList>
13#include <qpa/qplatformintegration.h>
14
15#include "imf/imf_client.h"
16#include "imf/input_control.h"
17
19
20class QQnxAbstractVirtualKeyboard;
21class QQnxIntegration;
22class QQnxImfRequest;
23
25{
27public:
30
31 // Indices for selecting and setting highlight colors.
37
38 bool isValid() const override;
39
40 bool filterEvent(const QEvent *event) override;
41 QRectF keyboardRect() const override;
42 void reset() override;
43 void commit() override;
44 void update(Qt::InputMethodQueries) override;
45 bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap, int sequenceId) override;
46
47
50 bool isInputPanelVisible() const override;
51
52 QLocale locale() const override;
53 void setFocusObject(QObject *object) override;
54
55 static void setHighlightColor(int index, const QColor &color);
56
57 static bool checkSpelling(const QString &text, void *context, void (*spellCheckDone)(void *context, const QString &text, const QList<int> &indices));
58
59private Q_SLOTS:
61 void keyboardLocaleChanged(const QLocale &locale);
62 void processImfEvent(QQnxImfRequest *event);
63
64private:
65 // IMF Event dispatchers
66 bool dispatchFocusGainEvent(int inputHints);
67 void dispatchFocusLossEvent();
68 bool dispatchRequestSoftwareInputPanel();
69 bool dispatchCloseSoftwareInputPanel();
70 int handleSpellCheck(spell_check_event_t *event);
71 int32_t processEvent(event_t *event);
72
73 void closeSession();
74 bool openSession();
75 bool hasSession();
76 void updateCursorPosition();
77 void endComposition();
78 void finishComposingText();
79 bool hasSelectedText();
80 void updateComposition(spannable_string_t *text, int32_t new_cursor_position);
81
82 // IMF Event handlers - these events will come in from QCoreApplication.
83 int32_t onCommitText(spannable_string_t *text, int32_t new_cursor_position);
84 int32_t onDeleteSurroundingText(int32_t left_length, int32_t right_length);
85 int32_t onGetCursorCapsMode(int32_t req_modes);
86 int32_t onFinishComposingText();
87 int32_t onGetCursorPosition();
88 spannable_string_t *onGetTextAfterCursor(int32_t n, int32_t flags);
89 spannable_string_t *onGetTextBeforeCursor(int32_t n, int32_t flags);
90 int32_t onSendEvent(event_t *event);
91 int32_t onSetComposingRegion(int32_t start, int32_t end);
92 int32_t onSetComposingText(spannable_string_t *text, int32_t new_cursor_position);
93 int32_t onIsTextSelected(int32_t* pIsSelected);
94 int32_t onIsAllTextSelected(int32_t* pIsSelected);
95 int32_t onForceUpdate();
96
97 int m_caretPosition;
98 bool m_isComposing;
99 QString m_composingText;
100 bool m_isUpdatingText;
101 bool m_inputPanelVisible;
102 QLocale m_inputPanelLocale;
103 // The object that had focus when the last highlight color was set.
104 QObject *m_focusObject;
105 // Indexed by HighlightIndex
106 QColor m_highlightColor[3];
107 QQnxIntegration *m_integration;
108 QQnxAbstractVirtualKeyboard &m_virtualKeyboard;
109};
110
111QT_END_NAMESPACE
112
113#endif // QQNXINPUTCONTEXT_H
spannable_string_t * text
input_session_t * session
spannable_string_t * result
QQnxImfRequest(input_session_t *_session, ImfEventType _type)
bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap, int sequenceId) override
void update(Qt::InputMethodQueries) override
Notification on editor updates.
bool isInputPanelVisible() const override
Returns input panel visibility status.
void reset() override
Method to be called when input method needs to be reset.
void hideInputPanel() override
Request to hide input panel.
static bool checkSpelling(const QString &text, void *context, void(*spellCheckDone)(void *context, const QString &text, const QList< int > &indices))
void setFocusObject(QObject *object) override
This virtual method gets called to notify updated focus to object.
QLocale locale() const override
bool isValid() const override
Returns input context validity.
bool filterEvent(const QEvent *event) override
This function can be reimplemented to filter input events.
QRectF keyboardRect() const override
This function can be reimplemented to return virtual keyboard rectangle in currently active window co...
void showInputPanel() override
Request to show input panel.
static void setHighlightColor(int index, const QColor &color)
QQnxScreen * primaryDisplay() const
static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
Q_GLOBAL_STATIC(QReadWriteLock, g_updateMutex)
static void(* p_imf_client_disconnect)()
static const input_session_t * sInputSession
static QQnxInputContext * sInputContextInstance
static bool imfAvailable()
static bool isSessionOkay(input_session_t *ic)
static spannable_string_t * toSpannableString(const QString &text)
static int adjustIndex(const QChar *text, int utf32Index, int utf16StartIndex, int *highSurrogateCount)
static bool s_imfInitFailed
static void initEvent(event_t *pEvent, const input_session_t *pSession, EventType eventType, int eventId, int eventSize)
static const input_session_t * sSpellCheckSession
static const input_session_t *(* p_ictrl_open_session)(connection_interface_t *)
static QColor sSelectedColor(0, 0xb8, 0, 85)
static void executeIMFRequest(QQnxImfRequest *event)
@ ImfSetComposingRegion
@ ImfFinishComposingText
@ ImfIsTextSelected
@ ImfGetTextAfterCursor
@ ImfGetTextBeforeCursor
@ ImfIsAllTextSelected
@ ImfSetComposingText
@ ImfGetCursorPosition
@ ImfDeleteSurroundingText
static void(* p_ictrl_close_session)(input_session_t *)
void(* spellCheckDone)(void *, const QString &, const QList< int > &)
SpellCheckInfo(void *_context, void(*_spellCheckDone)(void *, const QString &, const QList< int > &))