0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00

Keep bottom space has been fixed

This commit is contained in:
Arin Alexander 2023-04-11 13:39:54 +03:00
parent a969d3452b
commit a7cdb28b4a
4 changed files with 23 additions and 38 deletions

View File

@ -198,12 +198,6 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
BandDesignIntf::~BandDesignIntf()
{
// if (itemMode()&DesignMode){
// foreach(BandDesignIntf* band,childBands()) {
// removeChildBand(band);
// delete band;
// }
// }
delete m_bandMarker;
delete m_bandNameLabel;
}
@ -642,19 +636,6 @@ void BandDesignIntf::processPopUpAction(QAction *action)
ItemsContainerDesignInft::processPopUpAction(action);
}
//void BandDesignIntf::recalcItems(DataSourceManager* dataManager)
//{
// foreach(BaseDesignIntf* bi, childBaseItems()){
// ContentItemDesignIntf* ci = dynamic_cast<ContentItemDesignIntf*>(bi);
// if (bi){
// ContentItemDesignIntf* pci = dynamic_cast<ContentItemDesignIntf*>(bi->patternItem());
// ci->setContent(pci->content());
// }
// }
// updateItemSize(dataManager,FirstPass,height());
//}
BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
{
int maxBottom = 0;
@ -921,9 +902,9 @@ void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgrou
}
}
qreal BandDesignIntf::bottomSpace() const
qreal BandDesignIntf::bottomSpace()
{
return height()-findMaxBottom();
return m_bottomSpace;
}
void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QString& newName)
@ -957,14 +938,9 @@ void BandDesignIntf::setKeepTopSpace(bool value)
}
}
int BandDesignIntf::bootomSpace() const
void BandDesignIntf::setBottomSpace(qreal bottomSpace)
{
return m_bottomSpace;
}
void BandDesignIntf::setBootomSpace(int bootomSpace)
{
m_bottomSpace = bootomSpace;
m_bottomSpace = bottomSpace;
}
bool BandDesignIntf::repeatOnEachRow() const
@ -1137,7 +1113,6 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
spaceBorder += borderLineSize() + 2;
}
spaceBorder += m_bottomSpace;
restoreLinks();
snapshotItemsLayout();
@ -1163,6 +1138,15 @@ void BandDesignIntf::updateBandNameLabel()
if (m_bandNameLabel) m_bandNameLabel->updateLabel(bandTitle());
}
void BandDesignIntf::initFromItem(BaseDesignIntf *source)
{
ItemsContainerDesignInft::initFromItem(source);
BandDesignIntf* source_band = dynamic_cast<BandDesignIntf*>(source);
if (source_band){
this->setBottomSpace(source_band->bottomSpace());
}
}
QColor BandDesignIntf::selectionColor() const
{
return Qt::yellow;

View File

@ -156,8 +156,8 @@ public:
virtual bool isUnique() const;
void setItemMode(BaseDesignIntf::ItemMode mode);
void updateItemSize(DataSourceManager *dataManager, RenderPass pass=FirstPass, int maxHeight=0);
// void recalcItems(DataSourceManager* dataManager);
void updateBandNameLabel();
void initFromItem(BaseDesignIntf* source);
virtual QColor selectionColor() const;
int bandIndex() const;
@ -261,11 +261,10 @@ public:
void setAlternateBackgroundColor(const QColor &alternateBackgroundColor);
bool useAlternateBackgroundColor() const;
void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor);
qreal bottomSpace() const;
qreal bottomSpace();
void setBottomSpace(qreal bottomSpace);
void setBackgroundModeProperty(BGMode value);
void setBackgroundOpacity(int value);
int bootomSpace() const;
void setBootomSpace(int bootomSpace);
void updateBandMarkerGeometry();
int shiftItems() const;
void setShiftItems(int shiftItems);

View File

@ -265,7 +265,7 @@ public:
virtual BaseDesignIntf* cloneItem(LimeReport::BaseDesignIntf::ItemMode mode, QObject* owner=0, QGraphicsItem* parent=0);
virtual BaseDesignIntf* cloneItemWOChild(LimeReport::BaseDesignIntf::ItemMode mode, QObject* owner=0, QGraphicsItem* parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0) = 0;
void initFromItem(BaseDesignIntf* source);
virtual void initFromItem(BaseDesignIntf* source);
virtual bool canBeSplitted(int height) const;
virtual qreal minHeight() const {return 0;}

View File

@ -596,7 +596,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
bandClone = renderData(patternBand);
}
if (isLast) bandClone->setBootomSpace(1);
if (isLast) bandClone->setBottomSpace(1);
if (mode == ForcedStartPage){
savePage();
@ -1341,9 +1341,9 @@ void ReportRender::createTOCMarker(bool startNewRange)
BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, int height, BandDesignIntf* patternBand)
{
int sliceHeight = height;
BandDesignIntf* upperBandPart = dynamic_cast<BandDesignIntf*>(band->cloneUpperPart(sliceHeight));
BandDesignIntf* bottomBandPart = dynamic_cast<BandDesignIntf*>(band->cloneBottomPart(sliceHeight));
//int sliceHeight = height;
BandDesignIntf* upperBandPart = dynamic_cast<BandDesignIntf*>(band->cloneUpperPart(height));
BandDesignIntf* bottomBandPart = dynamic_cast<BandDesignIntf*>(band->cloneBottomPart(height));
if (!bottomBandPart->isEmpty()){
if (patternBand->keepFooterTogether())
closeFooterGroup(patternBand);
@ -1351,6 +1351,7 @@ BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, i
bottomBandPart->copyBookmarks(band);
}
if (!upperBandPart->isEmpty()){
upperBandPart->setBottomSpace(0);
upperBandPart->updateItemSize(m_datasources, FirstPass, height);
registerBand(upperBandPart);
upperBandPart->copyBookmarks(band);
@ -1397,6 +1398,7 @@ BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand, bool emitB
}
emit(patternBand->preparedForRender());
bandClone->setBottomSpace(patternBand->height() - patternBand->findMaxBottom());
bandClone->updateItemSize(m_datasources);
//m_scriptEngineContext->baseDesignIntfToScript(bandClone);