Android: Don't add QtEditText to foreign windows
We don't handle input on behalf of these windows, so we don't need a QtEditText for them. Any Qt managed child QWindow added to a foreign window will get its own QtEditText as normal. Change-Id: I32daa83f22487aadca7509379595b6c82b29ea4a Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io> (cherry picked from commit eea00824bdbc6740261d2b78821e31c1f21c9c0c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c45da998ad
commit
b9022081b0
@ -24,17 +24,22 @@ class QtWindow extends QtLayout implements QtSurfaceInterface {
|
|||||||
private static native void setSurface(int windowId, Surface surface);
|
private static native void setSurface(int windowId, Surface surface);
|
||||||
static native void windowFocusChanged(boolean hasFocus, int id);
|
static native void windowFocusChanged(boolean hasFocus, int id);
|
||||||
|
|
||||||
QtWindow(Context context, QtWindow parentWindow,
|
QtWindow(Context context, boolean isForeignWindow, QtWindow parentWindow,
|
||||||
QtInputConnection.QtInputConnectionListener listener)
|
QtInputConnection.QtInputConnectionListener listener)
|
||||||
{
|
{
|
||||||
super(context);
|
super(context);
|
||||||
setId(View.generateViewId());
|
setId(View.generateViewId());
|
||||||
m_editText = new QtEditText(context, listener);
|
|
||||||
m_inputConnectionListener = listener;
|
m_inputConnectionListener = listener;
|
||||||
setParent(parentWindow);
|
setParent(parentWindow);
|
||||||
setFocusableInTouchMode(true);
|
setFocusableInTouchMode(true);
|
||||||
addView(m_editText, new QtLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
|
if (!isForeignWindow) {
|
||||||
|
m_editText = new QtEditText(context, listener);
|
||||||
|
addView(m_editText, new QtLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
|
} else {
|
||||||
|
m_editText = null;
|
||||||
|
}
|
||||||
|
|
||||||
QtNative.runAction(() -> {
|
QtNative.runAction(() -> {
|
||||||
m_gestureDetector =
|
m_gestureDetector =
|
||||||
|
@ -72,7 +72,8 @@ void QAndroidPlatformWindow::initialize()
|
|||||||
"getInputConnectionListener");
|
"getInputConnectionListener");
|
||||||
|
|
||||||
m_nativeQtWindow = QJniObject::construct<QtJniTypes::QtWindow>(
|
m_nativeQtWindow = QJniObject::construct<QtJniTypes::QtWindow>(
|
||||||
QNativeInterface::QAndroidApplication::context(), m_nativeParentQtWindow, listener);
|
QNativeInterface::QAndroidApplication::context(),
|
||||||
|
isForeignWindow(), m_nativeParentQtWindow, listener);
|
||||||
m_nativeViewId = m_nativeQtWindow.callMethod<jint>("getId");
|
m_nativeViewId = m_nativeQtWindow.callMethod<jint>("getId");
|
||||||
|
|
||||||
if (window->isTopLevel())
|
if (window->isTopLevel())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user