Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqnxinputcontext_noimf.cpp
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
6#include "qqnxintegration.h"
7#include "qqnxscreen.h"
8
9#include <QtCore/QDebug>
10#include <QtGui/QGuiApplication>
11#include <QtGui/QInputMethodEvent>
12
14
15Q_LOGGING_CATEGORY(lcQpaInputMethods, "qt.qpa.input.methods");
16
19 m_inputPanelVisible(false),
20 m_inputPanelLocale(QLocale::c()),
21 m_integration(integration),
22 m_virtualKeyboard(keyboard)
23{
24 connect(&keyboard, SIGNAL(heightChanged(int)), this, SLOT(keyboardHeightChanged()));
25 connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool)));
26 connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale)));
27 keyboardVisibilityChanged(keyboard.isVisible());
28 keyboardLocaleChanged(keyboard.locale());
29}
30
32{
33}
34
36{
37 return true;
38}
39
40bool QQnxInputContext::hasPhysicalKeyboard()
41{
42 // TODO: This should query the system to check if a USB keyboard is connected.
43 return false;
44}
45
47{
48}
49
51{
52 if (hasPhysicalKeyboard())
53 return false;
54
56 m_virtualKeyboard.hideKeyboard();
57 qCDebug(lcQpaInputMethods) << "hiding virtual keyboard";
58 return false;
59 }
60
62 m_virtualKeyboard.showKeyboard();
63 qCDebug(lcQpaInputMethods) << "requesting virtual keyboard";
64 return false;
65 }
66
67 return false;
68
69}
70
72{
73 QRect screenGeometry = m_integration->primaryDisplay()->geometry();
74 return QRectF(screenGeometry.x(), screenGeometry.height() - m_virtualKeyboard.height(),
75 screenGeometry.width(), m_virtualKeyboard.height());
76}
77
78bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
79{
81 Q_UNUSED(sym);
82 Q_UNUSED(mod);
83 Q_UNUSED(scan);
85 return false;
86}
87
89{
90 qCDebug(lcQpaInputMethods) << Q_FUNC_INFO;
91 m_virtualKeyboard.showKeyboard();
92}
93
95{
96 qCDebug(lcQpaInputMethods) << Q_FUNC_INFO;
97 m_virtualKeyboard.hideKeyboard();
98}
99
101{
102 return m_inputPanelVisible;
103}
104
106{
107 return m_inputPanelLocale;
108}
109
110void QQnxInputContext::keyboardHeightChanged()
111{
113}
114
115void QQnxInputContext::keyboardVisibilityChanged(bool visible)
116{
117 qCDebug(lcQpaInputMethods) << "visible=" << visible;
118 if (m_inputPanelVisible != visible) {
119 m_inputPanelVisible = visible;
121 }
122}
123
124void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale)
125{
126 qCDebug(lcQpaInputMethods) << "locale=" << locale;
127 if (m_inputPanelLocale != locale) {
128 m_inputPanelLocale = locale;
130 }
131}
132
134{
135 qCDebug(lcQpaInputMethods) << "input item=" << object;;
136
137 if (!inputMethodAccepted()) {
138 if (m_inputPanelVisible)
140 } else {
143 int inputHints = query.value(Qt::ImHints).toInt();
144 Qt::EnterKeyType qtEnterKeyType = Qt::EnterKeyType(query.value(Qt::ImEnterKeyType).toInt());
145
146 m_virtualKeyboard.setInputHints(inputHints);
147 m_virtualKeyboard.setEnterKeyType(
149 );
150
151 if (!m_inputPanelVisible)
153 }
154}
155
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
\inmodule QtCore
Definition qcoreevent.h:45
@ CloseSoftwareInputPanel
Definition qcoreevent.h:249
@ RequestSoftwareInputPanel
Definition qcoreevent.h:248
The QInputMethodQueryEvent class provides an event sent by the input context to input objects.
Definition qevent.h:679
\inmodule QtCore
Definition qobject.h:103
The QPlatformInputContext class abstracts the input method dependent data and composing state.
bool inputMethodAccepted() const
Returns true if current focus object supports input method events.
void emitInputPanelVisibleChanged()
Active QPlatformInputContext is responsible for providing visible property to QInputMethod.
void emitKeyboardRectChanged()
Active QPlatformInputContext is responsible for providing keyboardRectangle property to QInputMethod.
virtual bool showKeyboard()=0
static EnterKeyType qtEnterKeyTypeToQnx(Qt::EnterKeyType type)
virtual bool hideKeyboard()=0
bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap, int sequenceId) override
QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard)
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.
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.
QQnxScreen * primaryDisplay() const
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
Definition qqnxscreen.h:48
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:239
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:185
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:236
Combined button and popup list for selecting options.
@ ImEnterKeyType
@ ImHints
EnterKeyType
#define Q_FUNC_INFO
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
#define SLOT(a)
Definition qobjectdefs.h:52
#define SIGNAL(a)
Definition qobjectdefs.h:53
GLuint object
[3]
GLbitfield flags
struct _cl_event * event
GLenum query
const GLubyte * c
GLenum cap
#define Q_UNUSED(x)
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)