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// Qt-Security score:significant reason:default
4
5#ifndef QQNXINPUTCONTEXT_H
6#define QQNXINPUTCONTEXT_H
7
8#include <qpa/qplatforminputcontext.h>
10
11#include <QtCore/QLocale>
12#include <QtCore/QMetaType>
13#include <QtCore/QList>
14#include <qpa/qplatformintegration.h>
15
16#include "imf/imf_client.h"
17#include "imf/input_control.h"
18
20
21class QQnxAbstractVirtualKeyboard;
22class QQnxIntegration;
23class QQnxImfRequest;
24
26{
28public:
31
32 // Indices for selecting and setting highlight colors.
38
39 bool isValid() const override;
40
41 bool filterEvent(const QEvent *event) override;
42 QRectF keyboardRect() const override;
43 void reset() override;
44 void commit() override;
45 void update(Qt::InputMethodQueries) override;
46 bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap, int sequenceId) override;
47
48
51 bool isInputPanelVisible() const override;
52
53 QLocale locale() const override;
54 void setFocusObject(QObject *object) override;
55
56 static void setHighlightColor(int index, const QColor &color);
57
58 static bool checkSpelling(const QString &text, void *context, void (*spellCheckDone)(void *context, const QString &text, const QList<int> &indices));
59
60private Q_SLOTS:
62 void keyboardLocaleChanged(const QLocale &locale);
63 void processImfEvent(QQnxImfRequest *event);
64
65private:
66 // IMF Event dispatchers
67 bool dispatchFocusGainEvent(int inputHints);
68 void dispatchFocusLossEvent();
69 bool dispatchRequestSoftwareInputPanel();
70 bool dispatchCloseSoftwareInputPanel();
71 int handleSpellCheck(spell_check_event_t *event);
72 int32_t processEvent(event_t *event);
73
74 void closeSession();
75 bool openSession();
76 bool hasSession();
77 void updateCursorPosition();
78 void endComposition();
79 void finishComposingText();
80 bool hasSelectedText();
81 void updateComposition(spannable_string_t *text, int32_t new_cursor_position);
82
83 // IMF Event handlers - these events will come in from QCoreApplication.
84 int32_t onCommitText(spannable_string_t *text, int32_t new_cursor_position);
85 int32_t onDeleteSurroundingText(int32_t left_length, int32_t right_length);
86 int32_t onGetCursorCapsMode(int32_t req_modes);
87 int32_t onFinishComposingText();
88 int32_t onGetCursorPosition();
89 spannable_string_t *onGetTextAfterCursor(int32_t n, int32_t flags);
90 spannable_string_t *onGetTextBeforeCursor(int32_t n, int32_t flags);
91 int32_t onSendEvent(event_t *event);
92 int32_t onSetComposingRegion(int32_t start, int32_t end);
93 int32_t onSetComposingText(spannable_string_t *text, int32_t new_cursor_position);
94 int32_t onIsTextSelected(int32_t* pIsSelected);
95 int32_t onIsAllTextSelected(int32_t* pIsSelected);
96 int32_t onForceUpdate();
97
98 int m_caretPosition;
99 bool m_isComposing;
100 QString m_composingText;
101 bool m_isUpdatingText;
102 bool m_inputPanelVisible;
103 QLocale m_inputPanelLocale;
104 // The object that had focus when the last highlight color was set.
105 QObject *m_focusObject;
106 // Indexed by HighlightIndex
107 QColor m_highlightColor[3];
108 QQnxIntegration *m_integration;
109 QQnxAbstractVirtualKeyboard &m_virtualKeyboard;
110};
111
112QT_END_NAMESPACE
113
114#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)
Combined button and popup list for selecting options.
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 > &))