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

HorizontalLayout has been fixed

This commit is contained in:
Arin Alexander 2017-09-21 14:46:36 +03:00
commit 3d6868b66d
2 changed files with 17 additions and 7 deletions

View File

@ -62,7 +62,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 4 LIMEREPORT_VERSION_MINOR = 4
LIMEREPORT_VERSION_RELEASE = 40 LIMEREPORT_VERSION_RELEASE = 42
LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"

View File

@ -292,7 +292,8 @@ void HorizontalLayout::objectLoadFinished()
void HorizontalLayout::updateLayoutSize() void HorizontalLayout::updateLayoutSize()
{ {
int w = ((borderLines() != 0) ? borderLineSize() : 0)*2; int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
int w = spaceBorder*2;
qreal h = 0; qreal h = 0;
foreach(BaseDesignIntf* item, m_children){ foreach(BaseDesignIntf* item, m_children){
if (item->isVisible()){ if (item->isVisible()){
@ -300,7 +301,7 @@ void HorizontalLayout::updateLayoutSize()
w+=item->width(); w+=item->width();
} }
} }
if (h>0) setHeight(h); if (h>0) setHeight(h+spaceBorder*2);
setWidth(w); setWidth(w);
} }
@ -418,14 +419,23 @@ BaseDesignIntf* HorizontalLayout::findPrior(BaseDesignIntf* item){
void HorizontalLayout::divideSpace(){ void HorizontalLayout::divideSpace(){
m_isRelocating = true; m_isRelocating = true;
qreal itemsSumSize = 0; qreal itemsSumSize = 0;
int visibleItemsCount = 0;
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
foreach(BaseDesignIntf* item, m_children){ foreach(BaseDesignIntf* item, m_children){
itemsSumSize += item->width(); if (item->isVisible()){
itemsSumSize += item->width();
visibleItemsCount++;
}
} }
qreal delta = (width() - itemsSumSize)/m_children.size(); qreal delta = (width() - (itemsSumSize+spaceBorder*2)) / (visibleItemsCount!=0 ? visibleItemsCount : 1);
for (int i=0; i<m_children.size(); ++i){ for (int i=0; i<m_children.size(); ++i){
m_children[i]->setWidth(m_children[i]->width()+(delta)); if (m_children[i]->isVisible())
m_children[i]->setWidth(m_children[i]->width()+delta);
if ((i+1)<m_children.size()) if ((i+1)<m_children.size())
m_children[i+1]->setPos(m_children[i+1]->pos().x()+delta*(i+1),m_children[i+1]->pos().y()); if (m_children[i+1]->isVisible())
m_children[i+1]->setPos(m_children[i+1]->pos().x()+delta*(i+1),m_children[i+1]->pos().y());
} }
m_isRelocating = false; m_isRelocating = false;
} }