summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Shparber <trollixx@gmail.com>2013-02-08 20:04:58 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-08 23:18:06 +0100
commit6b8d0b3092180dff54bfb68ab7765de40515c31d (patch)
treef4fadc6a55c38ea0b9efe93427d385ee97580577
parent4866fcf0081e0c416c0dc6f85f11eac66cde57ff (diff)
QNX: Add support for QInputMethod::keyboardRectangle()
Change-Id: Ie23aa06fed5778e228abf0f35fc1136a86661771 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp12
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_imf.h6
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp12
-rw-r--r--src/plugins/platforms/qnx/qqnxinputcontext_noimf.h5
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp2
5 files changed, 32 insertions, 5 deletions
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
index 30ca8a5c48..0d8f430c73 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
@@ -42,6 +42,8 @@
#include "qqnxinputcontext_imf.h"
#include "qqnxeventthread.h"
#include "qqnxabstractvirtualkeyboard.h"
+#include "qqnxintegration.h"
+#include "qqnxscreen.h"
#include <QtGui/QGuiApplication>
#include <QtGui/QInputMethodEvent>
@@ -645,12 +647,13 @@ static bool imfAvailable()
QT_BEGIN_NAMESPACE
-QQnxInputContext::QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard):
+QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard) :
QPlatformInputContext(),
m_lastCaretPos(0),
m_isComposing(false),
m_inputPanelVisible(false),
m_inputPanelLocale(QLocale::c()),
+ m_integration(integration),
m_virtualKeyboad(keyboard)
{
qInputContextDebug() << Q_FUNC_INFO;
@@ -857,6 +860,13 @@ bool QQnxInputContext::filterEvent( const QEvent *event )
}
}
+QRectF QQnxInputContext::keyboardRect() const
+{
+ QRect screenGeometry = m_integration->primaryDisplay()->geometry();
+ return QRectF(screenGeometry.x(), screenGeometry.height() - m_virtualKeyboard.height(),
+ screenGeometry.width(), m_virtualKeyboard.height());
+}
+
void QQnxInputContext::reset()
{
qInputContextDebug() << Q_FUNC_INFO;
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h
index 72c52300bb..1980a99ed9 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.h
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.h
@@ -54,21 +54,24 @@
QT_BEGIN_NAMESPACE
class QQnxAbstractVirtualKeyboard;
+class QQnxIntegration;
class QQnxInputContext : public QPlatformInputContext
{
Q_OBJECT
public:
- explicit QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard);
+ explicit QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard);
~QQnxInputContext();
bool isValid() const;
bool filterEvent(const QEvent *event);
+ QRectF keyboardRect() const;
void reset();
void update(Qt::InputMethodQueries);
bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
+
void showInputPanel();
void hideInputPanel();
bool isInputPanelVisible() const;
@@ -125,6 +128,7 @@ private:
QString m_composingText;
bool m_inputPanelVisible;
QLocale m_inputPanelLocale;
+ QQnxIntegration *m_integration;
QQnxAbstractVirtualKeyboard &m_virtualKeyboad;
};
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp
index 23d1f75539..98beb8ce43 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.cpp
@@ -41,6 +41,8 @@
#include "qqnxinputcontext_noimf.h"
#include "qqnxabstractvirtualkeyboard.h"
+#include "qqnxintegration.h"
+#include "qqnxscreen.h"
#include <QtCore/QDebug>
#include <QtGui/QGuiApplication>
@@ -53,10 +55,11 @@
QT_BEGIN_NAMESPACE
-QQnxInputContext::QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard) :
+QQnxInputContext::QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard) :
QPlatformInputContext(),
m_inputPanelVisible(false),
m_inputPanelLocale(QLocale::c()),
+ m_integration(integration),
m_virtualKeyboard(keyboard)
{
connect(&keyboard, SIGNAL(visibilityChanged(bool)), this, SLOT(keyboardVisibilityChanged(bool)));
@@ -105,6 +108,13 @@ bool QQnxInputContext::filterEvent( const QEvent *event )
}
+QRectF QQnxInputContext::keyboardRect() const
+{
+ QRect screenGeometry = m_integration->primaryDisplay()->geometry();
+ return QRectF(screenGeometry.x(), screenGeometry.height() - m_virtualKeyboard.height(),
+ screenGeometry.width(), m_virtualKeyboard.height());
+}
+
bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
{
Q_UNUSED(flags);
diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h
index c037b6afd0..3e9e929923 100644
--- a/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h
+++ b/src/plugins/platforms/qnx/qqnxinputcontext_noimf.h
@@ -49,18 +49,20 @@
QT_BEGIN_NAMESPACE
class QQnxAbstractVirtualKeyboard;
+class QQnxIntegration;
class QQnxInputContext : public QPlatformInputContext
{
Q_OBJECT
public:
- explicit QQnxInputContext(QQnxAbstractVirtualKeyboard &keyboard);
+ explicit QQnxInputContext(QQnxIntegration *integration, QQnxAbstractVirtualKeyboard &keyboard);
~QQnxInputContext();
bool isValid() const;
void reset();
bool filterEvent( const QEvent *event );
+ QRectF keyboardRect() const;
bool handleKeyboardEvent(int flags, int sym, int mod, int scan, int cap);
void showInputPanel();
@@ -79,6 +81,7 @@ private:
bool m_inputPanelVisible;
QLocale m_inputPanelLocale;
+ QQnxIntegration *m_integration;
QQnxAbstractVirtualKeyboard &m_virtualKeyboard;
};
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index d7370998d5..f3cfdab9c6 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -214,7 +214,7 @@ QQnxIntegration::QQnxIntegration()
#if defined(QQNX_PPS)
// Set up the input context
- m_inputContext = new QQnxInputContext(*m_virtualKeyboard);
+ m_inputContext = new QQnxInputContext(this, *m_virtualKeyboard);
#endif
}