mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +03:00
Bands relocation has been fixed
This commit is contained in:
parent
dff71b770e
commit
0e9b8055e9
@ -62,7 +62,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
|||||||
|
|
||||||
LIMEREPORT_VERSION_MAJOR = 1
|
LIMEREPORT_VERSION_MAJOR = 1
|
||||||
LIMEREPORT_VERSION_MINOR = 4
|
LIMEREPORT_VERSION_MINOR = 4
|
||||||
LIMEREPORT_VERSION_RELEASE = 93
|
LIMEREPORT_VERSION_RELEASE = 94
|
||||||
|
|
||||||
LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
|
LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"'
|
||||||
DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"
|
DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\"
|
||||||
|
@ -569,32 +569,37 @@ void PageItemDesignIntf::bandDeleted(QObject *band)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToSwap){
|
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());
|
int firstIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex());
|
||||||
// QList<BandDesignIntf*> bandToMove;
|
int secondIndex = std::max(band->minChildIndex(), bandToSwap->minChildIndex());
|
||||||
// foreach(BandDesignIntf* curBand, m_bands){
|
int moveIndex = std::min(band->maxChildIndex(), bandToSwap->maxChildIndex());
|
||||||
// if (curBand->bandIndex() > endIndex)
|
|
||||||
// bandToMove.append(curBand);
|
QList<BandDesignIntf*> 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;
|
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){
|
if (firstMoveBand == band){
|
||||||
bandToSwap->changeBandIndex(secondStartIndex,true);
|
bandToSwap->changeBandIndex(moveIndex,true);
|
||||||
} else {
|
} else {
|
||||||
band->changeBandIndex(secondStartIndex, true);
|
band->changeBandIndex(moveIndex, true);
|
||||||
}
|
}
|
||||||
relocateBands();
|
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)
|
void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry)
|
||||||
|
Loading…
Reference in New Issue
Block a user