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 <assam.boudjelthia@qt.io>
This commit is contained in:
Pekka Gehör 2021-02-05 11:24:10 +02:00
parent 5b681bea90
commit 37d6fd60a8

View File

@ -113,10 +113,13 @@ public class EditPopupMenu implements ViewTreeObserver.OnPreDrawListener, View.O
y2 -= m_view.getHeight(); y2 -= m_view.getHeight();
if (y2 < 0) { if (y2 < 0) {
if (cursorHandle != null) if (cursorHandle != null) {
y2 = cursorHandle.bottom(); y2 = cursorHandle.bottom();
else if (leftSelectionHandle != null && rightSelectionHandle != null) } else if (leftSelectionHandle != null && rightSelectionHandle != null) {
y2 = Math.max(leftSelectionHandle.bottom(), rightSelectionHandle.bottom()); y2 = Math.max(leftSelectionHandle.bottom(), rightSelectionHandle.bottom());
if (y2 <= 0)
m_layout.requestLayout();
}
} }
if (m_layout.getWidth() < x + m_view.getWidth() / 2) if (m_layout.getWidth() < x + m_view.getWidth() / 2)