Android: Request QtEditText focus when its window is touched
This allows switching focus between different Qt windows, which combined with the previous changes enables keyboard focus for child windows. Task-number: QTBUG-118139 Change-Id: I4b237166dee264a22b2e3dd1ca4d82e0cfce376b Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit e703feea40108cdd11f8f0270cc82c2aa0e691cd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
17e546ac7f
commit
3d01456b10
@ -331,7 +331,6 @@ class QtActivityDelegate extends QtActivityDelegateBase
|
|||||||
m_topLevelWindows.put(window.getId(), window);
|
m_topLevelWindows.put(window.getId(), window);
|
||||||
if (!m_splashScreenSticky)
|
if (!m_splashScreenSticky)
|
||||||
hideSplashScreen();
|
hideSplashScreen();
|
||||||
m_inputDelegate.setFocusedView(window.getQtEditText());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,6 @@ class QtInputDelegate {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
setEditTextOptions(enterKeyType, inputHints);
|
setEditTextOptions(enterKeyType, inputHints);
|
||||||
m_currentEditText.requestFocus();
|
|
||||||
|
|
||||||
m_currentEditText.postDelayed(() -> {
|
m_currentEditText.postDelayed(() -> {
|
||||||
m_imm.showSoftInput(m_currentEditText, 0, new ResultReceiver(new Handler()) {
|
m_imm.showSoftInput(m_currentEditText, 0, new ResultReceiver(new Handler()) {
|
||||||
|
@ -45,13 +45,6 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO this is a temporary workaround to be able to set the input delegate current edit text,
|
|
||||||
// the next two patches make this redundant
|
|
||||||
QtEditText getQtEditText()
|
|
||||||
{
|
|
||||||
return m_editText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setVisible(boolean visible) {
|
void setVisible(boolean visible) {
|
||||||
QtNative.runAction(() -> {
|
QtNative.runAction(() -> {
|
||||||
if (visible)
|
if (visible)
|
||||||
@ -70,6 +63,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event)
|
public boolean onTouchEvent(MotionEvent event)
|
||||||
{
|
{
|
||||||
|
m_editText.requestFocus();
|
||||||
event.setLocation(event.getX() + getX(), event.getY() + getY());
|
event.setLocation(event.getX() + getX(), event.getY() + getY());
|
||||||
QtInputDelegate.sendTouchEvent(event, getId());
|
QtInputDelegate.sendTouchEvent(event, getId());
|
||||||
m_gestureDetector.onTouchEvent(event);
|
m_gestureDetector.onTouchEvent(event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user