diff --git a/common.pri b/common.pri index cfc07e6..14c9a7b 100644 --- a/common.pri +++ b/common.pri @@ -105,7 +105,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 93 +LIMEREPORT_VERSION_RELEASE = 94 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 227e8e9..ff3fce4 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -703,32 +703,37 @@ void PageItemDesignIntf::bandDeleted(QObject *band) } void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToSwap){ - 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; -// foreach(BandDesignIntf* curBand, m_bands){ -// if (curBand->bandIndex() > endIndex) -// bandToMove.append(curBand); -// } + int firstIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex()); + int secondIndex = std::max(band->minChildIndex(), bandToSwap->minChildIndex()); + int moveIndex = std::min(band->maxChildIndex(), bandToSwap->maxChildIndex()); + + QList bandToMove; + foreach(BandDesignIntf* curBand, m_bands){ + if ( curBand->bandIndex() > moveIndex && curBand->bandIndex() < secondIndex && + curBand->bandType() == BandDesignIntf::Data && + curBand != band && curBand != bandToSwap + ) + bandToMove.append(curBand); + } BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band; - firstMoveBand->changeBandIndex(firstStartIndex, true); + firstMoveBand->changeBandIndex(firstIndex, true); + moveIndex = firstMoveBand->maxChildIndex() + 1; + qSort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen); + foreach(BandDesignIntf* curBand, bandToMove){ + curBand->changeBandIndex(moveIndex,true); + moveIndex = curBand->maxChildIndex() + 1; + } + if (firstMoveBand == band){ - bandToSwap->changeBandIndex(secondStartIndex,true); + bandToSwap->changeBandIndex(moveIndex,true); } else { - band->changeBandIndex(secondStartIndex, true); + band->changeBandIndex(moveIndex, true); } relocateBands(); -// int maxNewIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex()); -// if (maxNewIndex > endIndex){ -// foreach(BandDesignIntf* curBand, bandToMove){ -// curBand->setBandIndex(curBand->bandIndex()+(maxNewIndex - endIndex)); -// } -// } } void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry)