From 533eb7efa0b1974c14a173a6dbd024c20f658378 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 21 Dec 2018 19:05:31 +0300 Subject: [PATCH] Bands relocation has been fixed --- limereport/lrbanddesignintf.cpp | 2 +- limereport/lrpageitemdesignintf.cpp | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 1508b8e..fbef4f0 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -372,7 +372,7 @@ int BandDesignIntf::maxChildIndex(BandDesignIntf::BandsType bandType) const{ int BandDesignIntf::maxChildIndex(QSet ignoredBands) const{ int curIndex = bandIndex(); foreach(BandDesignIntf* childBand, childBands()){ - if (!ignoredBands.contains(childBand->bandType()) && childBand->bandIndex()>bandIndex()){ + if (!ignoredBands.contains(childBand->bandType())){ curIndex = std::max(curIndex,childBand->maxChildIndex(ignoredBands)); } } diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 9a7d350..364d42e 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -201,17 +201,22 @@ int PageItemDesignIntf::calcBandIndex(BandDesignIntf::BandsType bandType, BandDe int bandIndex=-1; qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex); - foreach(BandDesignIntf* band,m_bands){ - if ((band->bandType() == BandDesignIntf::GroupHeader) && ( band->bandType() > bandType)) break; - if ((band->bandType() <= bandType)){ - if (bandIndex <= band->bandIndex()) { - if (bandType != BandDesignIntf::Data){ + if (bandType != BandDesignIntf::Data){ + foreach(BandDesignIntf* band,m_bands){ + if ((band->bandType() == BandDesignIntf::GroupHeader) && ( band->bandType() > bandType)) break; + if ((band->bandType() <= bandType)){ + if (bandIndex <= band->bandIndex()) { bandIndex=band->maxChildIndex(bandType)+1; - } else { - bandIndex=band->maxChildIndex()+1; } - } - } else { increaseBandIndex = true; break;} + } else { increaseBandIndex = true; break;} + } + } else { + int maxChildIndex = 0; + foreach(BandDesignIntf* band, m_bands){ + if (band->bandType() == BandDesignIntf::Data) + maxChildIndex = std::max(maxChildIndex, band->maxChildIndex()); + } + bandIndex = std::max(bandIndex, maxChildIndex+1); } if (bandIndex==-1) {