mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +03:00
Layout space division has been changed
This commit is contained in:
parent
ce1656d2ef
commit
10015ed783
@ -141,7 +141,7 @@ void HorizontalLayout::setItemAlign(const BaseDesignIntf::ItemAlign &itemAlign)
|
|||||||
void HorizontalLayout::updateLayoutSize()
|
void HorizontalLayout::updateLayoutSize()
|
||||||
{
|
{
|
||||||
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
|
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
|
||||||
int w = spaceBorder*2;
|
qreal w = spaceBorder*2;
|
||||||
qreal h = 0;
|
qreal h = 0;
|
||||||
foreach(BaseDesignIntf* item, layoutsChildren()){
|
foreach(BaseDesignIntf* item, layoutsChildren()){
|
||||||
if (item->isEmpty() && hideEmptyItems()) item->setVisible(false);
|
if (item->isEmpty() && hideEmptyItems()) item->setVisible(false);
|
||||||
@ -151,7 +151,14 @@ void HorizontalLayout::updateLayoutSize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (h>0) setHeight(h+spaceBorder*2);
|
if (h>0) setHeight(h+spaceBorder*2);
|
||||||
|
if (layoutType() == Layout)
|
||||||
setWidth(w);
|
setWidth(w);
|
||||||
|
else{
|
||||||
|
relocateChildren();
|
||||||
|
if (!isRelocating()){
|
||||||
|
divideSpace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HorizontalLayout::relocateChildren()
|
void HorizontalLayout::relocateChildren()
|
||||||
@ -216,8 +223,12 @@ void HorizontalLayout::divideSpace(){
|
|||||||
visibleItemsCount++;
|
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){
|
for (int i=0; i<layoutsChildren().size(); ++i){
|
||||||
if (layoutsChildren()[i]->isVisible() || itemMode() == DesignMode)
|
if (layoutsChildren()[i]->isVisible() || itemMode() == DesignMode)
|
||||||
layoutsChildren()[i]->setWidth(layoutsChildren()[i]->width()+delta);
|
layoutsChildren()[i]->setWidth(layoutsChildren()[i]->width()+delta);
|
||||||
@ -225,6 +236,7 @@ void HorizontalLayout::divideSpace(){
|
|||||||
if (layoutsChildren()[i+1]->isVisible() || itemMode() == DesignMode)
|
if (layoutsChildren()[i+1]->isVisible() || itemMode() == DesignMode)
|
||||||
layoutsChildren()[i+1]->setPos(layoutsChildren()[i+1]->pos().x()+delta*(i+1),layoutsChildren()[i+1]->pos().y());
|
layoutsChildren()[i+1]->setPos(layoutsChildren()[i+1]->pos().x()+delta*(i+1),layoutsChildren()[i+1]->pos().y());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setIsRelocating(false);
|
setIsRelocating(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user