-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolumn.cpp
More file actions
28 lines (24 loc) · 710 Bytes
/
column.cpp
File metadata and controls
28 lines (24 loc) · 710 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
27
28
#include "column.h"
Column::Column(Item *parent, float x, float y, float w, float h)
: Item (parent, x, y, w, h)
{
}
void Column::performLayout() {
float yOffset = padding();
float maxWidth = 0;
for (auto child : mChildren) {
if (child->visible()) {
child->x = child->x() + padding();
child->y = yOffset;
yOffset += child->hieght() + spacing();
if (child->width() > maxWidth)
maxWidth = child->width();
}
}
if(hieght() == 0.0f && yOffset > spacing()) {
hieght = yOffset - spacing() + padding();
}
if(width() == 0.0f)
width = maxWidth + 2*padding();
Item::performLayout();
}