0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-11-20 06:30:03 +03:00

Fix: #37 Add possibility to move data bands when having many

Fix: #37 Add possibility to move data bands when having many
This commit is contained in:
Arin Alex
2016-06-24 17:36:25 +03:00
parent 6a507e5b61
commit 7311f84b0e
4 changed files with 57 additions and 9 deletions

View File

@@ -341,7 +341,6 @@ void PageItemDesignIntf::relocateBands()
posByColumn[0]+=m_bands[0]->height()+bandSpace;
}
if(m_bands.count()>1){
for(int i=0;i<(m_bands.count()-1);i++){
if ((m_bands[i+1]->bandType()!=BandDesignIntf::PageFooter) || (itemMode() & DesignMode)){
if (m_bands[i+1]->columnsCount()>1 &&
@@ -360,7 +359,9 @@ void PageItemDesignIntf::relocateBands()
posByColumn[m_bands[i+1]->columnIndex()] += m_bands[i+1]->height()+bandSpace;
}
}
}
foreach(BandDesignIntf* band, m_bands){
if (band->isSelected()) band->updateBandNameLabel();
}
}
}
@@ -515,8 +516,37 @@ void PageItemDesignIntf::bandDeleted(QObject *band)
relocateBands();
}
void PageItemDesignIntf::bandGeometryChanged(QObject *, QRectF /*newGeometry*/, QRectF /*oldGeometry*/)
void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry)
{
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(object);
int curIndex = band->bandIndex();
BandDesignIntf* bandToSwap = 0;
foreach(BandDesignIntf* curBand, bands()){
if (newGeometry.y()>oldGeometry.y()) {
if (curBand->bandType() == band->bandType()
&& curIndex<curBand->bandIndex()
&& (curBand->pos().y()+(curBand->height()/2))<newGeometry.y()
&& curBand->parentBand() == band->parentBand())
{
curIndex = curBand->bandIndex();
bandToSwap = curBand;
}
} else {
if (curBand->bandType() == band->bandType()
&& curIndex>curBand->bandIndex()
&& (curBand->pos().y()+(curBand->height()/2))>newGeometry.y()
&& curBand->parentBand() == band->parentBand())
{
curIndex = curBand->bandIndex();
bandToSwap = curBand;
}
}
}
if (curIndex != band->bandIndex()){
bandToSwap->changeBandIndex(band->bandIndex());
band->changeBandIndex(curIndex);
}
relocateBands();
}