Bands relocation has been fixed

This commit is contained in:
Arin Alexander 2018-12-21 19:05:31 +03:00
parent 37cbc134d1
commit 533eb7efa0
2 changed files with 15 additions and 10 deletions

View File

@ -372,7 +372,7 @@ int BandDesignIntf::maxChildIndex(BandDesignIntf::BandsType bandType) const{
int BandDesignIntf::maxChildIndex(QSet<BandDesignIntf::BandsType> ignoredBands) const{ int BandDesignIntf::maxChildIndex(QSet<BandDesignIntf::BandsType> ignoredBands) const{
int curIndex = bandIndex(); int curIndex = bandIndex();
foreach(BandDesignIntf* childBand, childBands()){ foreach(BandDesignIntf* childBand, childBands()){
if (!ignoredBands.contains(childBand->bandType()) && childBand->bandIndex()>bandIndex()){ if (!ignoredBands.contains(childBand->bandType())){
curIndex = std::max(curIndex,childBand->maxChildIndex(ignoredBands)); curIndex = std::max(curIndex,childBand->maxChildIndex(ignoredBands));
} }
} }

View File

@ -201,17 +201,22 @@ int PageItemDesignIntf::calcBandIndex(BandDesignIntf::BandsType bandType, BandDe
int bandIndex=-1; int bandIndex=-1;
qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex); qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex);
foreach(BandDesignIntf* band,m_bands){ if (bandType != BandDesignIntf::Data){
if ((band->bandType() == BandDesignIntf::GroupHeader) && ( band->bandType() > bandType)) break; foreach(BandDesignIntf* band,m_bands){
if ((band->bandType() <= bandType)){ if ((band->bandType() == BandDesignIntf::GroupHeader) && ( band->bandType() > bandType)) break;
if (bandIndex <= band->bandIndex()) { if ((band->bandType() <= bandType)){
if (bandType != BandDesignIntf::Data){ if (bandIndex <= band->bandIndex()) {
bandIndex=band->maxChildIndex(bandType)+1; 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) { if (bandIndex==-1) {