0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

Band relocation has been fixed

This commit is contained in:
Arin Alexander 2018-07-13 02:25:10 +03:00
parent 6015c77619
commit af12120260
5 changed files with 44 additions and 5 deletions

View File

@ -62,7 +62,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 4
LIMEREPORT_VERSION_RELEASE = 88
LIMEREPORT_VERSION_RELEASE = 89
LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"

View File

@ -389,6 +389,19 @@ int BandDesignIntf::minChildIndex(BandDesignIntf::BandsType bandType){
return curIndex;
}
int BandDesignIntf::minChildIndex(QSet<BandDesignIntf::BandsType> ignoredBands)
{
int curIndex = bandIndex();
foreach(BandDesignIntf* childBand, childBands()){
if (!ignoredBands.contains(childBand->bandType()) && childBand->bandIndex() < bandIndex()){
curIndex = std::min(curIndex, childBand->maxChildIndex(ignoredBands));
}
}
return curIndex;
}
QList<BandDesignIntf *> BandDesignIntf::childrenByType(BandDesignIntf::BandsType type)
{
QList<BandDesignIntf*> resList;

View File

@ -167,6 +167,7 @@ public:
bool isConnectedToBand(BandDesignIntf::BandsType bandType) const;
int minChildIndex(BandsType bandType);
int minChildIndex(QSet<BandsType> ignoredBands = QSet<BandDesignIntf::BandsType>());
int maxChildIndex(BandDesignIntf::BandsType bandType) const;
int maxChildIndex(QSet<BandsType> ignoredBands = QSet<BandDesignIntf::BandsType>()) const;

View File

@ -964,7 +964,9 @@ void BaseDesignIntf::setGeometryProperty(QRectF rect)
setWidth(rect.width());
if (rect.height() != geometry().height())
setHeight(rect.height());
if (!isLoading()) notify("geometry",oldValue,rect);
if (!isLoading()) {
notify("geometry",oldValue,rect);
}
}
}

View File

@ -595,9 +595,32 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry
}
}
if (curIndex != band->bandIndex()){
int swapIndex = bandToSwap->maxChildIndex();
bandToSwap->changeBandIndex(band->bandIndex(),true);
band->changeBandIndex(swapIndex,true);
int startIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex());
// int endIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex());
// QList<BandDesignIntf*> bandToMove;
// foreach(BandDesignIntf* curBand, m_bands){
// if (curBand->bandIndex() > endIndex)
// bandToMove.append(curBand);
// }
BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band;
firstMoveBand->changeBandIndex(startIndex, true);
if (firstMoveBand == band){
bandToSwap->changeBandIndex(firstMoveBand->maxChildIndex()+1,true);
} else {
band->changeBandIndex(firstMoveBand->maxChildIndex()+1, true);
}
// int maxNewIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex());
// if (maxNewIndex > endIndex){
// foreach(BandDesignIntf* curBand, bandToMove){
// curBand->setBandIndex(curBand->bandIndex()+(maxNewIndex - endIndex));
// }
// }
}
relocateBands();