From 08bfc160b83e28db6c4a8b619c07588bb1e238bd Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Mon, 16 Jul 2018 15:21:37 +0300 Subject: [PATCH] Band relocation fixed --- limereport/lrpageitemdesignintf.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index f13218d..a060aff 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -569,7 +569,8 @@ void PageItemDesignIntf::bandDeleted(QObject *band) } void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToSwap){ - int startIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex()); + int firstStartIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex()); + int secondStartIndex = std::max(band->minChildIndex(), bandToSwap->minChildIndex()); // int endIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); // QList bandToMove; @@ -580,11 +581,11 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band; - firstMoveBand->changeBandIndex(startIndex, true); + firstMoveBand->changeBandIndex(firstStartIndex, true); if (firstMoveBand == band){ - bandToSwap->changeBandIndex(firstMoveBand->maxChildIndex()+1,true); + bandToSwap->changeBandIndex(secondStartIndex,true); } else { - band->changeBandIndex(firstMoveBand->maxChildIndex()+1, true); + band->changeBandIndex(secondStartIndex, true); } relocateBands();