Android: Fix the offset of the EditPopupMenu
Fix the offset of the EditPopupMenu on application window. Issue caused by a5bb7b3ca510c301baf84e1dd46d5aeeb4986eb2 Fixes: QTBUG-71900 Change-Id: Ib95e1544fe91c273bc5317bd338a50a74fb1090a Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 526d62ee90d549177920eb567cb951c4b553c630) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
baa568c41e
commit
d6e414bfb1
@ -593,14 +593,25 @@ void QAndroidInputContext::updateSelectionHandles()
|
|||||||
|
|
||||||
if (cpos == anchor || im->anchorRectangle().isNull()) {
|
if (cpos == anchor || im->anchorRectangle().isNull()) {
|
||||||
auto curRect = cursorRectangle();
|
auto curRect = cursorRectangle();
|
||||||
QPoint cursorPoint = qPlatformWindow->mapToGlobal(QPoint(curRect.x() + (curRect.width() / 2), curRect.y() + curRect.height()));
|
QPoint cursorPointGlobal = qPlatformWindow->mapToGlobal(
|
||||||
QPoint editMenuPoint(cursorPoint.x(), cursorPoint.y());
|
QPoint(curRect.x() + (curRect.width() / 2), curRect.y() + curRect.height()));
|
||||||
|
QPoint cursorPoint(curRect.center().x(), curRect.bottom());
|
||||||
|
int x = curRect.x();
|
||||||
|
int y = curRect.y();
|
||||||
|
|
||||||
|
// Use x and y for the editMenuPoint from the cursorPointGlobal when the cursor is in the Dialog
|
||||||
|
if (cursorPointGlobal != cursorPoint) {
|
||||||
|
x = cursorPointGlobal.x();
|
||||||
|
y = cursorPointGlobal.y();
|
||||||
|
}
|
||||||
|
|
||||||
|
QPoint editMenuPoint(x, y);
|
||||||
m_handleMode &= ShowEditPopup;
|
m_handleMode &= ShowEditPopup;
|
||||||
m_handleMode |= ShowCursor;
|
m_handleMode |= ShowCursor;
|
||||||
uint32_t buttons = readOnly ? 0 : EditContext::PasteButton;
|
uint32_t buttons = readOnly ? 0 : EditContext::PasteButton;
|
||||||
if (!query.value(Qt::ImSurroundingText).toString().isEmpty())
|
if (!query.value(Qt::ImSurroundingText).toString().isEmpty())
|
||||||
buttons |= EditContext::SelectAllButton;
|
buttons |= EditContext::SelectAllButton;
|
||||||
QtAndroidInput::updateHandles(m_handleMode, editMenuPoint, buttons, cursorPoint);
|
QtAndroidInput::updateHandles(m_handleMode, editMenuPoint, buttons, cursorPointGlobal);
|
||||||
// The VK is hidden, reset the timer
|
// The VK is hidden, reset the timer
|
||||||
if (m_hideCursorHandleTimer.isActive())
|
if (m_hideCursorHandleTimer.isActive())
|
||||||
m_hideCursorHandleTimer.start();
|
m_hideCursorHandleTimer.start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user