fix vertical sort

This commit is contained in:
Eduardo Bart 2011-11-03 14:27:13 -02:00
parent dff57ecfe7
commit 5988867787
1 changed files with 3 additions and 1 deletions

View File

@ -33,7 +33,7 @@ void UIVerticalLayout::update()
UIWidgetPtr parentWidget = getParentWidget(); UIWidgetPtr parentWidget = getParentWidget();
UIWidgetList widgets = parentWidget->getChildren(); UIWidgetList widgets = parentWidget->getChildren();
// sort by Y center // sort by Y pos
std::sort(widgets.begin(), widgets.end(), std::sort(widgets.begin(), widgets.end(),
[](const UIWidgetPtr& first, const UIWidgetPtr& second) -> bool { [](const UIWidgetPtr& first, const UIWidgetPtr& second) -> bool {
return first->getY() < second->getY(); return first->getY() < second->getY();
@ -57,6 +57,8 @@ void UIVerticalLayout::update()
void UIVerticalLayout::addWidget(const UIWidgetPtr& widget) void UIVerticalLayout::addWidget(const UIWidgetPtr& widget)
{ {
// needed to be correcly sorted on update
widget->setY(9999);
update(); update();
} }