Android: Handle ImhNoTextHandles flag from InputMethodHints
[0]Qt::InputMethodHints has a flag ImhNoTextHandles that was not handled. This flag should be considered when QAndroidInputContext is updating Text handles position. What is more, this flag can be used to fix the problem with visible text cursor out of the text object. [0]https://doc.qt.io/qt-6/qt.html#InputMethodHint-enum Task-number: QTBUG-115005 Pick-to: 6.6 6.5 Change-Id: Ie50b77d7afbadfebe73f10137f09da9560aea1ba Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>bb10
parent
fca11e0112
commit
0f0ab90cf6
|
|
@ -531,12 +531,25 @@ void QAndroidInputContext::updateCursorPosition()
|
|||
}
|
||||
}
|
||||
|
||||
bool QAndroidInputContext::isImhNoTextHandlesSet()
|
||||
{
|
||||
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQuery();
|
||||
if (query.isNull())
|
||||
return false;
|
||||
return query->value(Qt::ImHints).toUInt() & Qt::ImhNoTextHandles;
|
||||
}
|
||||
|
||||
void QAndroidInputContext::updateSelectionHandles()
|
||||
{
|
||||
static bool noHandles = qEnvironmentVariableIntValue("QT_QPA_NO_TEXT_HANDLES");
|
||||
if (noHandles || !m_focusObject)
|
||||
return;
|
||||
|
||||
if (isImhNoTextHandlesSet()) {
|
||||
QtAndroidInput::updateHandles(Hidden);
|
||||
return;
|
||||
}
|
||||
|
||||
auto im = qGuiApp->inputMethod();
|
||||
|
||||
QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition | Qt::ImEnabled
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ private slots:
|
|||
void showInputPanelLater(Qt::ApplicationState);
|
||||
|
||||
private:
|
||||
bool isImhNoTextHandlesSet();
|
||||
void sendInputMethodEvent(QInputMethodEvent *event);
|
||||
QSharedPointer<QInputMethodQueryEvent> focusObjectInputMethodQuery(Qt::InputMethodQueries queries = Qt::ImQueryAll);
|
||||
bool focusObjectIsComposing() const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue