diff options
author | BogDan Vatra <bogdan@kdab.com> | 2016-03-21 11:33:19 +0200 |
---|---|---|
committer | BogDan Vatra <bogdan@kdab.com> | 2016-03-21 12:16:19 +0000 |
commit | 51e71d411156054d291d88cdd4690f48f7710d43 (patch) | |
tree | d0922eb7b2bfba62f6267ae1d297f3611b571f62 /src | |
parent | bc913ea452b2b23ab54dfbfc29567b9e9d8760ac (diff) |
Android: Fix inputItemRectangle when using EnableHighDpiScaling
When EnableHighDpiScaling is enabled, qGuiApp->inputMethod()-
>inputItemRectangle() returns the position divided by pixel density,
therefore all the controls positions must by multiplied by pixel density
to translate them into screen coordinates.
Task-number: QTBUG-52001
Change-Id: Iea92a912cfbab03a9497fc8cddc24bebd0db2192
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/android/qandroidinputcontext.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 0eddb26959..f3ece3208e 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -39,6 +39,7 @@ #include "androidjniinput.h" #include "qandroideventdispatcher.h" #include "androiddeadlockprotector.h" +#include "qandroidplatformintegration.h" #include <QDebug> #include <qevent.h> #include <qguiapplication.h> @@ -47,6 +48,7 @@ #include <qinputmethod.h> #include <qwindow.h> #include <QtCore/private/qjni_p.h> +#include <private/qhighdpiscaling_p.h> #include <QTextCharFormat> @@ -541,10 +543,13 @@ void QAndroidInputContext::showInputPanel() if (window) rect = QRect(window->mapToGlobal(rect.topLeft()), rect.size()); - QtAndroidInput::showSoftwareKeyboard(rect.left(), - rect.top(), - rect.width(), - rect.height(), + double pixelDensity = window ? QHighDpiScaling::factor(window) + : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); + + QtAndroidInput::showSoftwareKeyboard(rect.left() * pixelDensity, + rect.top() * pixelDensity, + rect.width() * pixelDensity, + rect.height() * pixelDensity, query->value(Qt::ImHints).toUInt(), query->value(Qt::ImEnterKeyType).toUInt() ); |