0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 16:44:39 +03:00

Layout space division has been changed

This commit is contained in:
Arin Alexander 2019-01-14 23:36:27 +03:00
parent ce1656d2ef
commit 10015ed783

View File

@ -141,7 +141,7 @@ void HorizontalLayout::setItemAlign(const BaseDesignIntf::ItemAlign &itemAlign)
void HorizontalLayout::updateLayoutSize()
{
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
int w = spaceBorder*2;
qreal w = spaceBorder*2;
qreal h = 0;
foreach(BaseDesignIntf* item, layoutsChildren()){
if (item->isEmpty() && hideEmptyItems()) item->setVisible(false);
@ -151,7 +151,14 @@ void HorizontalLayout::updateLayoutSize()
}
}
if (h>0) setHeight(h+spaceBorder*2);
if (layoutType() == Layout)
setWidth(w);
else{
relocateChildren();
if (!isRelocating()){
divideSpace();
}
}
}
void HorizontalLayout::relocateChildren()
@ -216,8 +223,12 @@ void HorizontalLayout::divideSpace(){
visibleItemsCount++;
}
}
qreal delta = (width() - (itemsSumSize+spaceBorder*2)) / (visibleItemsCount!=0 ? visibleItemsCount : 1);
if (itemMode() == DesignMode && !layoutsChildren().isEmpty()){
qreal delta = (width() - (itemsSumSize+spaceBorder*2));
layoutsChildren().last()->setWidth(layoutsChildren().last()->width()+delta);
} else {
qreal delta = (width() - (itemsSumSize+spaceBorder*2)) / (visibleItemsCount!=0 ? visibleItemsCount : 1);
for (int i=0; i<layoutsChildren().size(); ++i){
if (layoutsChildren()[i]->isVisible() || itemMode() == DesignMode)
layoutsChildren()[i]->setWidth(layoutsChildren()[i]->width()+delta);
@ -225,6 +236,7 @@ void HorizontalLayout::divideSpace(){
if (layoutsChildren()[i+1]->isVisible() || itemMode() == DesignMode)
layoutsChildren()[i+1]->setPos(layoutsChildren()[i+1]->pos().x()+delta*(i+1),layoutsChildren()[i+1]->pos().y());
}
}
setIsRelocating(false);
}