Android: Allow requesting qtvirtualkeyboard with QT_IM_MODULE

Allow Android apps to request qtvirtualkeyboard using environment
variable QT_IM_MODULE.

Similar to commit b46fe39d94 for Windows
platform.

Task-number: QTBUG-80357
Change-Id: I584859729e60f5d73943ca5840a9dcd169cc9ecb
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
Assam Boudjelthia 2020-01-16 16:09:33 +02:00
parent c3050b6d96
commit 6d6ca70538
2 changed files with 15 additions and 2 deletions

View File

@ -74,6 +74,8 @@
#include "qandroidplatformvulkaninstance.h"
#endif
#include <QtGui/qpa/qplatforminputcontextfactory_p.h>
QT_BEGIN_NAMESPACE
int QAndroidPlatformIntegration::m_defaultGeometryWidth = 320;
@ -255,6 +257,15 @@ static bool needsBasicRenderloopWorkaround()
return needsWorkaround;
}
void QAndroidPlatformIntegration::initialize()
{
const QString icStr = QPlatformInputContextFactory::requested();
if (icStr.isNull())
m_inputContext.reset(new QAndroidInputContext);
else
m_inputContext.reset(QPlatformInputContextFactory::create(icStr));
}
bool QAndroidPlatformIntegration::hasCapability(Capability cap) const
{
switch (cap) {
@ -366,7 +377,7 @@ QPlatformClipboard *QAndroidPlatformIntegration::clipboard() const
QPlatformInputContext *QAndroidPlatformIntegration::inputContext() const
{
return &m_platformInputContext;
return m_inputContext.data();
}
QPlatformNativeInterface *QAndroidPlatformIntegration::nativeInterface() const

View File

@ -81,6 +81,8 @@ public:
QAndroidPlatformIntegration(const QStringList &paramList);
~QAndroidPlatformIntegration();
void initialize() override;
bool hasCapability(QPlatformIntegration::Capability cap) const override;
QPlatformWindow *createPlatformWindow(QWindow *window) const override;
@ -167,7 +169,7 @@ private:
mutable QPlatformAccessibility *m_accessibility;
#endif
mutable QAndroidInputContext m_platformInputContext;
QScopedPointer<QPlatformInputContext> m_inputContext;
};
QT_END_NAMESPACE