From ea74221121cb9fce9dbac0ed10199ab612655ad5 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Thu, 21 Sep 2017 13:51:03 +0300 Subject: [PATCH] HorizontalLayout has been fixed --- common.pri | 2 +- limereport/items/lrhorizontallayout.cpp | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/common.pri b/common.pri index d47159f..3bff285 100644 --- a/common.pri +++ b/common.pri @@ -62,7 +62,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 40 +LIMEREPORT_VERSION_RELEASE = 42 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/items/lrhorizontallayout.cpp b/limereport/items/lrhorizontallayout.cpp index 9ca4b0a..af91f09 100644 --- a/limereport/items/lrhorizontallayout.cpp +++ b/limereport/items/lrhorizontallayout.cpp @@ -292,7 +292,8 @@ void HorizontalLayout::objectLoadFinished() void HorizontalLayout::updateLayoutSize() { - int w = ((borderLines() != 0) ? borderLineSize() : 0)*2; + int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0; + int w = spaceBorder*2; qreal h = 0; foreach(BaseDesignIntf* item, m_children){ if (item->isVisible()){ @@ -300,7 +301,7 @@ void HorizontalLayout::updateLayoutSize() w+=item->width(); } } - if (h>0) setHeight(h); + if (h>0) setHeight(h+spaceBorder*2); setWidth(w); } @@ -418,14 +419,23 @@ BaseDesignIntf* HorizontalLayout::findPrior(BaseDesignIntf* item){ void HorizontalLayout::divideSpace(){ m_isRelocating = true; qreal itemsSumSize = 0; + int visibleItemsCount = 0; + int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0; + 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; isetWidth(m_children[i]->width()+(delta)); + if (m_children[i]->isVisible()) + m_children[i]->setWidth(m_children[i]->width()+delta); if ((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; }