summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2021-01-13 13:55:02 +0100
committerMorten Sørvig <morten.sorvig@qt.io>2021-02-01 20:06:52 +0100
commitfddc0b34dfa7fae74aca43534642a40ea1e30381 (patch)
tree1e529478dbafbc4d10bd1064eb0d47f2a1883314 /src/plugins/platforms/android
parent7c572884608c87036b2e6cc214a2ee62c3b6100b (diff)
Add geometry accessors to QPlatformInputContext
Currently the platform plugins use the public QInputMethod API when querying geometry. However, QInputMethod returns geometry in device independent pixels, while the platform plugins require geometry in native pixels. Add new API to QPlatformInputContext which returns input geometry in the native window coordinate system: QRectF inputItemRectangle() QRectF inputItemClipRectangle() QRectF cursorRectangle() QRectF anchorRectangle() QRectF keyboardRectangle() These make the relevant QHighDpi calls internally, and such calls can then be moved out of the platform plugins. Disambiguate inputItemRectangle() in qandroidinputcontext.cpp by renaming it to screenInputItemRectangle(). Change-Id: I561745b64fb197d64e3dfddcf0751528bb8d0605 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/plugins/platforms/android')
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index 06947c9c32..24cb261e6f 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -405,7 +405,7 @@ static JNINativeMethod methods[] = {
{"updateCursorPosition", "()Z", (void *)updateCursorPosition}
};
-static QRect inputItemRectangle()
+static QRect screenInputItemRectangle()
{
QRectF itemRect = qGuiApp->inputMethod()->inputItemRectangle();
QRect rect = qGuiApp->inputMethod()->inputItemTransform().mapRect(itemRect).toRect();
@@ -786,7 +786,7 @@ void QAndroidInputContext::handleLocationChanged(int handleId, int x, int y)
void QAndroidInputContext::touchDown(int x, int y)
{
- if (m_focusObject && inputItemRectangle().contains(x, y)) {
+ if (m_focusObject && screenInputItemRectangle().contains(x, y)) {
// If the user touch the input rectangle, we can show the cursor handle
m_handleMode = ShowCursor;
// The VK will appear in a moment, stop the timer
@@ -820,7 +820,7 @@ void QAndroidInputContext::longPress(int x, int y)
if (noHandles)
return;
- if (m_focusObject && inputItemRectangle().contains(x, y)) {
+ if (m_focusObject && screenInputItemRectangle().contains(x, y)) {
BatchEditLock batchEditLock(this);
focusObjectStopComposing();
@@ -928,7 +928,7 @@ void QAndroidInputContext::showInputPanel()
else
m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition()));
- QRect rect = inputItemRectangle();
+ QRect rect = screenInputItemRectangle();
QtAndroidInput::showSoftwareKeyboard(rect.left(), rect.top(), rect.width(), rect.height(),
query->value(Qt::ImHints).toUInt(),
query->value(Qt::ImEnterKeyType).toUInt());