QNX: Add support for QInputMethod::keyboardRectangle()

Change-Id: Ie23aa06fed5778e228abf0f35fc1136a86661771
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
Oleg Shparber 2013-02-08 20:04:58 +02:00 committed by The Qt Project
parent 4866fcf008
commit 6b8d0b3092
5 changed files with 32 additions and 5 deletions

View File

@ -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;

View File

@ -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;
};

View File

@ -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);

View File

@ -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;
};

View File

@ -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
}