Android: fix (partially) text deletion when the cursor is moved
- wait until the handle location changes the cursor position - don't update cursor position if: * a batchEdit is in progress * the UpdateSelection is blocked - finish the composing before update the cursor - add the missing .java files There are still corner situations when the text gets deleted/moved, but those are pretty rare and they will be fix in another patch. Task-number: QTBUG-57507 Change-Id: I230d7f64625fb556e1be3069694a71e9bc91323a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
bb0f29f82b
commit
36e4b13e29
@ -17,7 +17,9 @@ JAVASOURCES += \
|
||||
$$PATHPREFIX/QtNativeLibrariesDir.java \
|
||||
$$PATHPREFIX/QtSurface.java \
|
||||
$$PATHPREFIX/ExtractStyle.java \
|
||||
$$PATHPREFIX/QtServiceDelegate.java
|
||||
$$PATHPREFIX/EditMenu.java \
|
||||
$$PATHPREFIX/EditPopupMenu.java \
|
||||
$$PATHPREFIX/CursorHandle.java
|
||||
|
||||
# install
|
||||
target.path = $$[QT_INSTALL_PREFIX]/jar
|
||||
|
@ -810,7 +810,7 @@ namespace QtAndroidInput
|
||||
#endif
|
||||
QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
|
||||
if (inputContext && qGuiApp)
|
||||
QMetaObject::invokeMethod(inputContext, "handleLocationChanged",
|
||||
QMetaObject::invokeMethod(inputContext, "handleLocationChanged", Qt::BlockingQueuedConnection,
|
||||
Q_ARG(int, id), Q_ARG(int, x), Q_ARG(int, y));
|
||||
|
||||
}
|
||||
|
@ -578,6 +578,11 @@ void QAndroidInputContext::updateSelectionHandles()
|
||||
*/
|
||||
void QAndroidInputContext::handleLocationChanged(int handleId, int x, int y)
|
||||
{
|
||||
if (m_batchEditNestingLevel.load() || m_blockUpdateSelection)
|
||||
return;
|
||||
|
||||
finishComposingText();
|
||||
|
||||
auto im = qGuiApp->inputMethod();
|
||||
auto leftRect = im->cursorRectangle();
|
||||
// The handle is down of the cursor, but we want the position in the middle.
|
||||
|
@ -152,7 +152,7 @@ private:
|
||||
CursorHandleShowPopup = 3
|
||||
};
|
||||
CursorHandleShowMode m_cursorHandleShown;
|
||||
int m_batchEditNestingLevel;
|
||||
QAtomicInt m_batchEditNestingLevel;
|
||||
QObject *m_focusObject;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user