-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrow.cpp
More file actions
26 lines (22 loc) · 684 Bytes
/
row.cpp
File metadata and controls
26 lines (22 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "row.h"
Row::Row(Item *parent, float x, float y, float w, float h): Item(parent, x, y, w, h) {
}
void Row::performLayout() {
float xOffset = padding();
float maxHieght = 0;
for (auto child : mChildren) {
if (child->visible()) {
child->x = xOffset;
child->y = padding();
xOffset += child->width() + spacing();
if (child->hieght() > maxHieght)
maxHieght = child->hieght();
}
}
if(width() == 0.0f && xOffset > spacing()) {
width = xOffset - spacing() + padding();
}
if(hieght() == 0.0f)
hieght = maxHieght + 2*padding();
Item::performLayout();
}