removeGap property has been added to PageFooterBand

This commit is contained in:
Arin Alexander 2020-04-17 12:28:59 +03:00
parent d738d23446
commit a4acb912a5
9 changed files with 39 additions and 9 deletions

View File

@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5 LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 47 LIMEREPORT_VERSION_RELEASE = 49
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}\\\"

View File

@ -51,6 +51,10 @@ namespace LimeReport {
#define VARIABLE_IS_NOT_USED #define VARIABLE_IS_NOT_USED
#endif #endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
Q_NAMESPACE
#endif
namespace Const{ namespace Const{
int const DEFAULT_GRID_STEP = 1; int const DEFAULT_GRID_STEP = 1;
int const RESIZE_HANDLE_SIZE = 5; int const RESIZE_HANDLE_SIZE = 5;
@ -150,9 +154,6 @@ namespace Const{
typedef QStyleOptionViewItem StyleOptionViewItem; typedef QStyleOptionViewItem StyleOptionViewItem;
#endif #endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
Q_NAMESPACE
#endif
class Enums class Enums
{ {
public: public:

View File

@ -50,7 +50,7 @@ namespace LimeReport{
PageFooter::PageFooter(QObject *owner, QGraphicsItem *parent) PageFooter::PageFooter(QObject *owner, QGraphicsItem *parent)
: BandDesignIntf(LimeReport::BandDesignIntf::PageFooter,xmlTag,owner,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") ); setBandTypeText( tr("Page Footer") );
setMarkerColor(bandColor()); setMarkerColor(bandColor());
@ -90,6 +90,16 @@ void PageFooter::processPopUpAction(QAction *action)
BandDesignIntf::processPopUpAction(action); BandDesignIntf::processPopUpAction(action);
} }
bool PageFooter::removeGap() const
{
return m_removeGap;
}
void PageFooter::setRemoveGap(bool removeGap)
{
m_removeGap = removeGap;
}
bool PageFooter::printOnFirstPage() const bool PageFooter::printOnFirstPage() const
{ {
return m_printOnFirstPage; return m_printOnFirstPage;

View File

@ -40,6 +40,7 @@ class PageFooter : public BandDesignIntf
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool printOnFirstPage READ printOnFirstPage WRITE setPrintOnFirstPage) Q_PROPERTY(bool printOnFirstPage READ printOnFirstPage WRITE setPrintOnFirstPage)
Q_PROPERTY(bool printOnLastPage READ printOnLastPage WRITE setPrintOnLastPage) Q_PROPERTY(bool printOnLastPage READ printOnLastPage WRITE setPrintOnLastPage)
Q_PROPERTY(bool removeGap READ removeGap WRITE setRemoveGap)
public: public:
PageFooter(QObject* owner = 0, QGraphicsItem* parent=0); PageFooter(QObject* owner = 0, QGraphicsItem* parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
@ -48,6 +49,8 @@ public:
void setPrintOnLastPage(bool printOnLastPage); void setPrintOnLastPage(bool printOnLastPage);
bool printOnFirstPage() const; bool printOnFirstPage() const;
void setPrintOnFirstPage(bool printOnFirstPage); void setPrintOnFirstPage(bool printOnFirstPage);
bool removeGap() const;
void setRemoveGap(bool removeGap);
protected: protected:
QColor bandColor() const; QColor bandColor() const;
@ -56,6 +59,7 @@ protected:
private: private:
bool m_printOnFirstPage; bool m_printOnFirstPage;
bool m_printOnLastPage; bool m_printOnLastPage;
bool m_removeGap;
}; };
} }

View File

@ -181,7 +181,8 @@ BandDesignIntf *PageItemDesignIntf::bandByType(BandDesignIntf::BandsType bandTyp
QList<BandDesignIntf*>::const_iterator it = childBands().constBegin(); QList<BandDesignIntf*>::const_iterator it = childBands().constBegin();
for(;it!=childBands().constEnd();++it){ for(;it!=childBands().constEnd();++it){
if ( (*it)->bandType()==bandType) return (*it); if ( (*it)->bandType()==bandType) return (*it);
} return 0; }
return 0;
} }
bool PageItemDesignIntf::isBandExists(BandDesignIntf::BandsType bandType) bool PageItemDesignIntf::isBandExists(BandDesignIntf::BandsType bandType)

View File

@ -149,7 +149,8 @@ void ReportRender::renameChildItems(BaseDesignIntf *item){
ReportRender::ReportRender(QObject *parent) ReportRender::ReportRender(QObject *parent)
:QObject(parent), m_renderPageItem(0), m_pageCount(0), :QObject(parent), m_renderPageItem(0), m_pageCount(0),
m_lastRenderedHeader(0), m_lastDataBand(0), m_lastRenderedFooter(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(); initColumns();
} }
@ -1134,6 +1135,8 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren)
emit m_lastDataBand->bandRegistred(); emit m_lastDataBand->bandRegistred();
#endif #endif
} }
if (band->bandType() != BandDesignIntf::PageFooter)
m_lastRenderedBand = band;
return true; return true;
} else return false; } else return false;
} }
@ -1505,8 +1508,6 @@ void ReportRender::savePage(bool isLast)
m_datasources->setReportVariable("#PAGE",m_datasources->variable("#PAGE").toInt()+1); 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_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem));
m_pageCount++; m_pageCount++;
emit pageRendered(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_renderPageItem->placeTearOffBand();
m_scriptEngineContext->setCurrentPage(m_renderPageItem); m_scriptEngineContext->setCurrentPage(m_renderPageItem);
emit m_patternPageItem->afterRender(); emit m_patternPageItem->afterRender();
if (isLast) if (isLast)

View File

@ -212,6 +212,7 @@ private:
BandDesignIntf* m_lastRenderedHeader; BandDesignIntf* m_lastRenderedHeader;
BandDesignIntf* m_lastDataBand; BandDesignIntf* m_lastDataBand;
BandDesignIntf* m_lastRenderedFooter; BandDesignIntf* m_lastRenderedFooter;
BandDesignIntf* m_lastRenderedBand;
bool m_renderCanceled; bool m_renderCanceled;
QVector<qreal> m_maxHeightByColumn; QVector<qreal> m_maxHeightByColumn;
QVector<qreal> m_currentStartDataPos; QVector<qreal> m_currentStartDataPos;

View File

@ -164,6 +164,7 @@ void QObjectPropertyModel::translatePropertyName()
tr("geometryLocked"); tr("geometryLocked");
tr("printBehavior"); tr("printBehavior");
tr("shiftItems"); tr("shiftItems");
tr("removeGap");
} }
void QObjectPropertyModel::clearObjectsList() void QObjectPropertyModel::clearObjectsList()

View File

@ -2026,6 +2026,10 @@ p, li { white-space: pre-wrap; }
<source>shiftItems</source> <source>shiftItems</source>
<translation>Смещение элементов</translation> <translation>Смещение элементов</translation>
</message> </message>
<message>
<source>removeGap</source>
<translation>Удалять разрыв</translation>
</message>
</context> </context>
<context> <context>
<name>LimeReport::RectPropItem</name> <name>LimeReport::RectPropItem</name>