Skip to content

Commit cb3c6f9

Browse files
committed
Do not add spacing for children with size 0
1 parent d74949c commit cb3c6f9

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

core/Column.qml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Layout {
2020
var p = 0
2121
var w = 0
2222
this.count = children.length
23+
2324
for(var i = 0; i < children.length; ++i) {
2425
var c = children[i]
2526
if (!('height' in c))
@@ -32,7 +33,7 @@ Layout {
3233
if (r > w)
3334
w = r
3435
c.viewY = p + tm
35-
if (c.visible)
36+
if (c.visible && c.height > 0)
3637
p += c.height + tm + bm + this.spacing
3738
}
3839
if (p > 0)

core/ListView.qml

+6-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ BaseView {
101101
s = 0
102102

103103
if (horizontal) {
104-
x += s + spacing
104+
if (s > 0)
105+
x += s + spacing
105106
} else {
106-
y += s + spacing
107+
if (s > 0)
108+
y += s + spacing
107109
}
108110
}
109111
return [x, y, w, h]
@@ -273,7 +275,8 @@ BaseView {
273275
}
274276
}
275277

276-
p += s + this.spacing
278+
if (s > 0)
279+
p += s + this.spacing
277280
}
278281
if (p > startPos)
279282
p -= this.spacing;

core/Row.qml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Layout {
2020
var p = 0
2121
var h = 0
2222
this.count = children.length
23+
2324
for(var i = 0; i < children.length; ++i) {
2425
var c = children[i]
2526
if (!('width' in c))
@@ -32,7 +33,7 @@ Layout {
3233
if (b > h)
3334
h = b
3435
c.viewX = p + rm
35-
if (c.visible)
36+
if (c.visible && c.width > 0)
3637
p += c.width + this.spacing + rm + lm
3738
}
3839
if (p > 0)

0 commit comments

Comments
 (0)