Android: Make QtLayout support MATCH_PARENT layout params
QtLayout did not properly handle resizing child views to the parent's size when their layout params width or height were MATCH_PARENT. This was mostly visible when embedding QML to a normal Android app, as there the Android view hierarchy is responsible for setting the size, instead of Qt setting it every time the QWindow size changes. Task-number: QTBUG-123306 Pick-to: 6.7 Change-Id: I08cbfa8e352d0cb2ca5b6e5aa40e891a62b82eb4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>bb10
parent
7eb69e0f7a
commit
b3685743f3
|
|
@ -91,7 +91,6 @@ class QtLayout extends ViewGroup {
|
|||
protected void onLayout(boolean changed, int l, int t, int r, int b)
|
||||
{
|
||||
int count = getChildCount();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
View child = getChildAt(i);
|
||||
if (child.getVisibility() != GONE) {
|
||||
|
|
@ -100,10 +99,11 @@ class QtLayout extends ViewGroup {
|
|||
|
||||
int childLeft = lp.x;
|
||||
int childTop = lp.y;
|
||||
child.layout(childLeft, childTop,
|
||||
childLeft + child.getMeasuredWidth(),
|
||||
childTop + child.getMeasuredHeight());
|
||||
|
||||
int childRight = (lp.width == ViewGroup.LayoutParams.MATCH_PARENT) ?
|
||||
r - l : childLeft + child.getMeasuredWidth();
|
||||
int childBottom = (lp.height == ViewGroup.LayoutParams.MATCH_PARENT) ?
|
||||
b - t : childTop + child.getMeasuredHeight();
|
||||
child.layout(childLeft, childTop, childRight, childBottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue