Qt 6.x
The Qt SDK
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
13#if defined(QQNXINPUTCONTEXT_DEBUG)
14#define qInputContextDebug qDebug
15#else
16#define qInputContextDebug QT_NO_QDEBUG_MACRO
17#endif
18
20
23 m_inputPanelVisible(false),
24 m_inputPanelLocale(QLocale::c()),
25 m_integration(integration),
26 m_virtualKeyboard(keyboard)
27{
28 connect(&keyboard, SIGNAL(heightChanged(int)), this, SLOT(keyboardHeightChanged()));
29 connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool)));
30 connect(&keyboard, SIGNAL(localeChanged(QLocale)), this, SLOT(keyboardLocaleChanged(QLocale)));
31 keyboardVisibilityChanged(keyboard.isVisible());
32 keyboardLocaleChanged(keyboard.locale());
33}
34
36{
37}
38
40{
41 return true;
42}
43
44bool QQnxInputContext::hasPhysicalKeyboard()
45{
46 // TODO: This should query the system to check if a USB keyboard is connected.
47 return false;
48}
49
51{
52}
53
55{
56 if (hasPhysicalKeyboard())
57 return false;
58
60 m_virtualKeyboard.hideKeyboard();
61 qInputContextDebug("hiding virtual keyboard");
62 return false;
63 }
64
66 m_virtualKeyboard.showKeyboard();
67 qInputContextDebug("requesting virtual keyboard");
68 return false;
69 }
70
71 return false;
72
73}
74
76{
77 QRect screenGeometry = m_integration->primaryDisplay()->geometry();
78 return QRectF(screenGeometry.x(), screenGeometry.height() - m_virtualKeyboard.height(),
79 screenGeometry.width(), m_virtualKeyboard.height());
80}
81
82bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
83{
85 Q_UNUSED(sym);
86 Q_UNUSED(mod);
87 Q_UNUSED(scan);
89 return false;
90}
91
93{
95 m_virtualKeyboard.showKeyboard();
96}
97
99{
101 m_virtualKeyboard.hideKeyboard();
102}
103
105{
106 return m_inputPanelVisible;
107}
108
110{
111 return m_inputPanelLocale;
112}
113
114void QQnxInputContext::keyboardHeightChanged()
115{
117}
118
119void QQnxInputContext::keyboardVisibilityChanged(bool visible)
120{
121 qInputContextDebug() << "visible=" << visible;
122 if (m_inputPanelVisible != visible) {
123 m_inputPanelVisible = visible;
125 }
126}
127
128void QQnxInputContext::keyboardLocaleChanged(const QLocale &locale)
129{
130 qInputContextDebug() << "locale=" << locale;
131 if (m_inputPanelLocale != locale) {
132 m_inputPanelLocale = locale;
134 }
135}
136
138{
139 qInputContextDebug() << "input item=" << object;
140
141 if (!inputMethodAccepted()) {
142 if (m_inputPanelVisible)
144 } else {
147 int inputHints = query.value(Qt::ImHints).toInt();
148 Qt::EnterKeyType qtEnterKeyType = Qt::EnterKeyType(query.value(Qt::ImEnterKeyType).toInt());
149
150 m_virtualKeyboard.setInputHints(inputHints);
151 m_virtualKeyboard.setEnterKeyType(
153 );
154
155 if (!m_inputPanelVisible)
157 }
158}
159
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:678
\inmodule QtCore
Definition qobject.h:90
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:44
\inmodule QtCore\reentrant
Definition qrect.h:483
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:238
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:184
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:235
Combined button and popup list for selecting options.
@ ImEnterKeyType
@ ImHints
EnterKeyType
#define SLOT(a)
Definition qobjectdefs.h:51
#define SIGNAL(a)
Definition qobjectdefs.h:52
GLuint object
[3]
GLbitfield flags
struct _cl_event * event
GLenum query
const GLubyte * c
GLenum cap
#define qInputContextDebug
#define Q_UNUSED(x)
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)