From 37d6fd60a800a0956b41870aca338a30e0bd5768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20Geh=C3=B6r?= Date: Fri, 5 Feb 2021 11:24:10 +0200 Subject: [PATCH] Android: Fix position issue of the EditPopupMenu Set y for the EditPopupMenu from the previous correct value if select handles values are zero. The SelectionHandle.bottom() is zero if selection handles have not yet been displayed on the screen. Task-number: QTBUG-71900 Change-Id: I3694a8edd4f0d8f8799dbac1217a75c375038e66 Reviewed-by: Assam Boudjelthia --- .../jar/src/org/qtproject/qt/android/EditPopupMenu.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt/android/EditPopupMenu.java b/src/android/jar/src/org/qtproject/qt/android/EditPopupMenu.java index 131f2a103f2..99940bbd020 100644 --- a/src/android/jar/src/org/qtproject/qt/android/EditPopupMenu.java +++ b/src/android/jar/src/org/qtproject/qt/android/EditPopupMenu.java @@ -113,10 +113,13 @@ public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, View.O y2 -= m_view.getHeight(); if (y2 < 0) { - if (cursorHandle != null) + if (cursorHandle != null) { y2 = cursorHandle.bottom(); - else if (leftSelectionHandle != null && rightSelectionHandle != null) + } else if (leftSelectionHandle != null && rightSelectionHandle != null) { y2 = Math.max(leftSelectionHandle.bottom(), rightSelectionHandle.bottom()); + if (y2 <= 0) + m_layout.requestLayout(); + } } if (m_layout.getWidth() < x + m_view.getWidth() / 2)