From a4acb912a5478e0b1601a5f105bb518eddcd340c Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 17 Apr 2020 12:28:59 +0300 Subject: [PATCH] removeGap property has been added to PageFooterBand --- common.pri | 2 +- include/lrglobal.h | 7 ++++--- limereport/bands/lrpagefooter.cpp | 12 +++++++++++- limereport/bands/lrpagefooter.h | 4 ++++ limereport/lrpageitemdesignintf.cpp | 3 ++- limereport/lrreportrender.cpp | 14 +++++++++++--- limereport/lrreportrender.h | 1 + limereport/objectinspector/lrobjectitemmodel.cpp | 1 + translations/limereport_ru.ts | 4 ++++ 9 files changed, 39 insertions(+), 9 deletions(-) diff --git a/common.pri b/common.pri index 3f6738b..32339c3 100644 --- a/common.pri +++ b/common.pri @@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 5 -LIMEREPORT_VERSION_RELEASE = 47 +LIMEREPORT_VERSION_RELEASE = 49 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/include/lrglobal.h b/include/lrglobal.h index 1c8075f..8a312d8 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -51,6 +51,10 @@ namespace LimeReport { #define VARIABLE_IS_NOT_USED #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) +Q_NAMESPACE +#endif + namespace Const{ int const DEFAULT_GRID_STEP = 1; int const RESIZE_HANDLE_SIZE = 5; @@ -150,9 +154,6 @@ namespace Const{ typedef QStyleOptionViewItem StyleOptionViewItem; #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) - Q_NAMESPACE -#endif class Enums { public: diff --git a/limereport/bands/lrpagefooter.cpp b/limereport/bands/lrpagefooter.cpp index 8ee5959..9793487 100644 --- a/limereport/bands/lrpagefooter.cpp +++ b/limereport/bands/lrpagefooter.cpp @@ -50,7 +50,7 @@ namespace LimeReport{ PageFooter::PageFooter(QObject *owner, QGraphicsItem *parent) : BandDesignIntf(LimeReport::BandDesignIntf::PageFooter,xmlTag,owner,parent), - m_printOnFirstPage(true), m_printOnLastPage(true) + m_printOnFirstPage(true), m_printOnLastPage(true), m_removeGap(false) { setBandTypeText( tr("Page Footer") ); setMarkerColor(bandColor()); @@ -90,6 +90,16 @@ void PageFooter::processPopUpAction(QAction *action) BandDesignIntf::processPopUpAction(action); } +bool PageFooter::removeGap() const +{ + return m_removeGap; +} + +void PageFooter::setRemoveGap(bool removeGap) +{ + m_removeGap = removeGap; +} + bool PageFooter::printOnFirstPage() const { return m_printOnFirstPage; diff --git a/limereport/bands/lrpagefooter.h b/limereport/bands/lrpagefooter.h index 3422b60..5c18c7c 100644 --- a/limereport/bands/lrpagefooter.h +++ b/limereport/bands/lrpagefooter.h @@ -40,6 +40,7 @@ class PageFooter : public BandDesignIntf Q_OBJECT Q_PROPERTY(bool printOnFirstPage READ printOnFirstPage WRITE setPrintOnFirstPage) Q_PROPERTY(bool printOnLastPage READ printOnLastPage WRITE setPrintOnLastPage) + Q_PROPERTY(bool removeGap READ removeGap WRITE setRemoveGap) public: PageFooter(QObject* owner = 0, QGraphicsItem* parent=0); virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); @@ -48,6 +49,8 @@ public: void setPrintOnLastPage(bool printOnLastPage); bool printOnFirstPage() const; void setPrintOnFirstPage(bool printOnFirstPage); + bool removeGap() const; + void setRemoveGap(bool removeGap); protected: QColor bandColor() const; @@ -56,6 +59,7 @@ protected: private: bool m_printOnFirstPage; bool m_printOnLastPage; + bool m_removeGap; }; } diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 15b200f..927784e 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -181,7 +181,8 @@ BandDesignIntf *PageItemDesignIntf::bandByType(BandDesignIntf::BandsType bandTyp QList::const_iterator it = childBands().constBegin(); for(;it!=childBands().constEnd();++it){ if ( (*it)->bandType()==bandType) return (*it); - } return 0; + } + return 0; } bool PageItemDesignIntf::isBandExists(BandDesignIntf::BandsType bandType) diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index d88d7bd..65e39c9 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -149,7 +149,8 @@ void ReportRender::renameChildItems(BaseDesignIntf *item){ ReportRender::ReportRender(QObject *parent) :QObject(parent), m_renderPageItem(0), m_pageCount(0), m_lastRenderedHeader(0), m_lastDataBand(0), m_lastRenderedFooter(0), - m_currentColumn(0), m_newPageStarted(false), m_lostHeadersMoved(false) + m_lastRenderedBand(0), m_currentColumn(0), m_newPageStarted(false), + m_lostHeadersMoved(false) { initColumns(); } @@ -1134,6 +1135,8 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren) emit m_lastDataBand->bandRegistred(); #endif } + if (band->bandType() != BandDesignIntf::PageFooter) + m_lastRenderedBand = band; return true; } else return false; } @@ -1505,8 +1508,6 @@ void ReportRender::savePage(bool isLast) m_datasources->setReportVariable("#PAGE",m_datasources->variable("#PAGE").toInt()+1); } - BandDesignIntf* pageFooter = m_renderPageItem->bandByType(BandDesignIntf::PageFooter); - if (pageFooter) pageFooter->setBandIndex(++m_currentIndex); m_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem)); m_pageCount++; emit pageRendered(m_pageCount); @@ -1518,7 +1519,14 @@ void ReportRender::savePage(bool isLast) } } + if (m_renderPageItem->pageFooter()){ + m_renderPageItem->pageFooter()->setBandIndex(++m_currentIndex); + if (m_renderPageItem->pageFooter()->property("removeGap").toBool()){ + m_renderPageItem->pageFooter()->setPos(m_lastRenderedBand->geometry().bottomLeft()); + } + } m_renderPageItem->placeTearOffBand(); + m_scriptEngineContext->setCurrentPage(m_renderPageItem); emit m_patternPageItem->afterRender(); if (isLast) diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index a825ffc..739018e 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -212,6 +212,7 @@ private: BandDesignIntf* m_lastRenderedHeader; BandDesignIntf* m_lastDataBand; BandDesignIntf* m_lastRenderedFooter; + BandDesignIntf* m_lastRenderedBand; bool m_renderCanceled; QVector m_maxHeightByColumn; QVector m_currentStartDataPos; diff --git a/limereport/objectinspector/lrobjectitemmodel.cpp b/limereport/objectinspector/lrobjectitemmodel.cpp index 0f725db..8e28ff6 100644 --- a/limereport/objectinspector/lrobjectitemmodel.cpp +++ b/limereport/objectinspector/lrobjectitemmodel.cpp @@ -164,6 +164,7 @@ void QObjectPropertyModel::translatePropertyName() tr("geometryLocked"); tr("printBehavior"); tr("shiftItems"); + tr("removeGap"); } void QObjectPropertyModel::clearObjectsList() diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 47156ee..9a85f2b 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -2026,6 +2026,10 @@ p, li { white-space: pre-wrap; } shiftItems Смещение элементов + + removeGap + Удалять разрыв + LimeReport::RectPropItem