Input direction/locale to come from platform input context
Change-Id: Ib049693211a08dcffc9dbe49add54e7feab38978 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>bb10
parent
30ad53a0a6
commit
8ae55a3484
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
#include <qinputpanel.h>
|
||||
#include <private/qinputpanel_p.h>
|
||||
#include "private/qkeymapper_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -254,7 +253,11 @@ bool QInputPanel::isAnimating() const
|
|||
*/
|
||||
QLocale QInputPanel::locale() const
|
||||
{
|
||||
return qt_keymapper_private()->keyboardInputLocale;
|
||||
Q_D(const QInputPanel);
|
||||
QPlatformInputContext *ic = d->platformInputContext();
|
||||
if (ic)
|
||||
return ic->locale();
|
||||
return QLocale::c();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -263,7 +266,11 @@ QLocale QInputPanel::locale() const
|
|||
*/
|
||||
Qt::LayoutDirection QInputPanel::inputDirection() const
|
||||
{
|
||||
return qt_keymapper_private()->keyboardInputDirection;
|
||||
Q_D(const QInputPanel);
|
||||
QPlatformInputContext *ic = d->platformInputContext();
|
||||
if (ic)
|
||||
return ic->inputDirection();
|
||||
return Qt::LeftToRight;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include <qplatforminputcontext_qpa.h>
|
||||
#include <qguiapplication.h>
|
||||
#include <QRect>
|
||||
#include "private/qkeymapper_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -207,4 +208,25 @@ void QPlatformInputContext::emitInputPanelVisibleChanged()
|
|||
emit qApp->inputPanel()->visibleChanged();
|
||||
}
|
||||
|
||||
QLocale QPlatformInputContext::locale() const
|
||||
{
|
||||
return qt_keymapper_private()->keyboardInputLocale;
|
||||
}
|
||||
|
||||
void QPlatformInputContext::emitLocaleChanged()
|
||||
{
|
||||
emit qApp->inputPanel()->localeChanged();
|
||||
}
|
||||
|
||||
Qt::LayoutDirection QPlatformInputContext::inputDirection() const
|
||||
{
|
||||
return qt_keymapper_private()->keyboardInputDirection;
|
||||
}
|
||||
|
||||
void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
|
||||
{
|
||||
emit qApp->inputPanel()->inputDirectionChanged(newDirection);
|
||||
}
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -77,6 +77,11 @@ public:
|
|||
virtual void hideInputPanel();
|
||||
virtual bool isInputPanelVisible() const;
|
||||
void emitInputPanelVisibleChanged();
|
||||
|
||||
virtual QLocale locale() const;
|
||||
void emitLocaleChanged();
|
||||
virtual Qt::LayoutDirection inputDirection() const;
|
||||
void emitInputDirectionChanged(Qt::LayoutDirection newDirection);
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ public:
|
|||
m_updateCallCount(0),
|
||||
m_resetCallCount(0),
|
||||
m_commitCallCount(0),
|
||||
m_localeCallCount(0),
|
||||
m_inputDirectionCallCount(0),
|
||||
m_lastQueries(Qt::ImhNone),
|
||||
m_action(QInputPanel::Click),
|
||||
m_cursorPosition(0),
|
||||
|
|
@ -91,12 +93,24 @@ public:
|
|||
{
|
||||
return m_visible;
|
||||
}
|
||||
virtual QLocale locale() const
|
||||
{
|
||||
m_localeCallCount++;
|
||||
return QLocale::c();
|
||||
}
|
||||
virtual Qt::LayoutDirection inputDirection() const
|
||||
{
|
||||
m_inputDirectionCallCount++;
|
||||
return Qt::LeftToRight;
|
||||
}
|
||||
|
||||
bool m_animating;
|
||||
bool m_visible;
|
||||
int m_updateCallCount;
|
||||
int m_resetCallCount;
|
||||
int m_commitCallCount;
|
||||
mutable int m_localeCallCount;
|
||||
mutable int m_inputDirectionCallCount;
|
||||
Qt::InputMethodQueries m_lastQueries;
|
||||
QInputPanel::Action m_action;
|
||||
int m_cursorPosition;
|
||||
|
|
@ -144,6 +158,7 @@ private slots:
|
|||
void commit();
|
||||
void update();
|
||||
void query();
|
||||
void inputDirection();
|
||||
private:
|
||||
InputItem m_inputItem;
|
||||
PlatformInputContext m_platformInputContext;
|
||||
|
|
@ -312,5 +327,16 @@ void tst_qinputpanel::query()
|
|||
QCOMPARE(cursorRectangle, QRect(1,2,3,4));
|
||||
}
|
||||
|
||||
void tst_qinputpanel::inputDirection()
|
||||
{
|
||||
QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, 0);
|
||||
qApp->inputPanel()->inputDirection();
|
||||
QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, 1);
|
||||
|
||||
QCOMPARE(m_platformInputContext.m_localeCallCount, 0);
|
||||
qApp->inputPanel()->locale();
|
||||
QCOMPARE(m_platformInputContext.m_localeCallCount, 1);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_qinputpanel)
|
||||
#include "tst_qinputpanel.moc"
|
||||
|
|
|
|||
Loading…
Reference in New Issue