fix vertical sort
This commit is contained in:
parent
dff57ecfe7
commit
5988867787
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue