mirror of
				https://github.com/python-LimeReport/LimeReport.git
				synced 2025-10-31 22:01:22 +03:00 
			
		
		
		
	printAlways has been moved to BandDesignIntf & printAlways property has been added to DataHeaderBand & DataFooterBand
This commit is contained in:
		| @@ -62,6 +62,7 @@ class DataHeaderBand : public BandDesignIntf | |||||||
|     Q_OBJECT |     Q_OBJECT | ||||||
|     Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage) |     Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage) | ||||||
|     Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) |     Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) | ||||||
|  |     Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) | ||||||
| public: | public: | ||||||
|     DataHeaderBand(QObject* owner=0, QGraphicsItem* parent=0); |     DataHeaderBand(QObject* owner=0, QGraphicsItem* parent=0); | ||||||
|     bool isUnique() const {return false;} |     bool isUnique() const {return false;} | ||||||
| @@ -76,6 +77,7 @@ private: | |||||||
| class DataFooterBand : public BandDesignIntf | class DataFooterBand : public BandDesignIntf | ||||||
| { | { | ||||||
|     Q_OBJECT |     Q_OBJECT | ||||||
|  |     Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) | ||||||
| public: | public: | ||||||
|     DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0); |     DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0); | ||||||
|     bool isUnique() const {return false;} |     bool isUnique() const {return false;} | ||||||
|   | |||||||
| @@ -106,7 +106,7 @@ QColor SubDetailBand::bandColor() const | |||||||
| //SubDetailHeaderBand | //SubDetailHeaderBand | ||||||
|  |  | ||||||
| SubDetailHeaderBand::SubDetailHeaderBand(QObject *owner, QGraphicsItem *parent) | SubDetailHeaderBand::SubDetailHeaderBand(QObject *owner, QGraphicsItem *parent) | ||||||
|     :BandDesignIntf(BandDesignIntf::SubDetailHeader,xmlTagHeader,owner,parent), m_printAlways(false) |     :BandDesignIntf(BandDesignIntf::SubDetailHeader,xmlTagHeader,owner,parent) | ||||||
| { | { | ||||||
|     setBandTypeText(tr("SubDetailHeader")); |     setBandTypeText(tr("SubDetailHeader")); | ||||||
|     setMarkerColor(bandColor()); |     setMarkerColor(bandColor()); | ||||||
| @@ -130,7 +130,7 @@ BaseDesignIntf *SubDetailHeaderBand::createSameTypeItem(QObject *owner, QGraphic | |||||||
| //SubDetailFooterBand | //SubDetailFooterBand | ||||||
|  |  | ||||||
| SubDetailFooterBand::SubDetailFooterBand(QObject *owner, QGraphicsItem *parent) | SubDetailFooterBand::SubDetailFooterBand(QObject *owner, QGraphicsItem *parent) | ||||||
|     : BandDesignIntf(BandDesignIntf::SubDetailFooter,xmlTagFooter,owner,parent), m_printAlways(false) |     : BandDesignIntf(BandDesignIntf::SubDetailFooter,xmlTagFooter,owner,parent) | ||||||
| { | { | ||||||
|     setMarkerColor(bandColor()); |     setMarkerColor(bandColor()); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -59,14 +59,10 @@ class SubDetailHeaderBand : public BandDesignIntf | |||||||
| public: | public: | ||||||
|     SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0); |     SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0); | ||||||
|     bool isUnique() const; |     bool isUnique() const; | ||||||
|     void setPrintAlways(bool value){m_printAlways=value;} |  | ||||||
|     bool printAlways(){return m_printAlways;} |  | ||||||
| protected: | protected: | ||||||
|     QColor bandColor() const; |     QColor bandColor() const; | ||||||
| private: | private: | ||||||
|     BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); |     BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); | ||||||
| private: |  | ||||||
|     bool m_printAlways; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| class SubDetailFooterBand : public BandDesignIntf | class SubDetailFooterBand : public BandDesignIntf | ||||||
| @@ -75,8 +71,6 @@ class SubDetailFooterBand : public BandDesignIntf | |||||||
|     Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) |     Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) | ||||||
| public: | public: | ||||||
|     SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent=0); |     SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent=0); | ||||||
|     void setPrintAlways(bool value){m_printAlways=value;} |  | ||||||
|     bool printAlways(){return m_printAlways;} |  | ||||||
|     virtual bool isUnique() const; |     virtual bool isUnique() const; | ||||||
|     bool isFooter() const{return true;} |     bool isFooter() const{return true;} | ||||||
| protected: | protected: | ||||||
| @@ -84,7 +78,6 @@ protected: | |||||||
| private: | private: | ||||||
|     BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); |     BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); | ||||||
| private: | private: | ||||||
|     bool m_printAlways; |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -143,7 +143,8 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q | |||||||
|     m_columnsFillDirection(Horizontal), |     m_columnsFillDirection(Horizontal), | ||||||
|     m_reprintOnEachPage(false), |     m_reprintOnEachPage(false), | ||||||
|     m_startNewPage(false), |     m_startNewPage(false), | ||||||
|     m_startFromNewPage(false) |     m_startFromNewPage(false), | ||||||
|  |     m_printAlways(false) | ||||||
| { | { | ||||||
|     setPosibleResizeDirectionFlags(ResizeBottom); |     setPosibleResizeDirectionFlags(ResizeBottom); | ||||||
|     setPosibleMoveFlags(TopBotom); |     setPosibleMoveFlags(TopBotom); | ||||||
| @@ -709,6 +710,16 @@ void BandDesignIntf::childBandDeleted(QObject *band) | |||||||
|     m_childBands.removeAt(m_childBands.indexOf(reinterpret_cast<BandDesignIntf*>(band))); |     m_childBands.removeAt(m_childBands.indexOf(reinterpret_cast<BandDesignIntf*>(band))); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | bool BandDesignIntf::printAlways() const | ||||||
|  | { | ||||||
|  |     return m_printAlways; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void BandDesignIntf::setPrintAlways(bool printAlways) | ||||||
|  | { | ||||||
|  |     m_printAlways = printAlways; | ||||||
|  | } | ||||||
|  |  | ||||||
| bool BandDesignIntf::startFromNewPage() const | bool BandDesignIntf::startFromNewPage() const | ||||||
| { | { | ||||||
|     return m_startFromNewPage; |     return m_startFromNewPage; | ||||||
|   | |||||||
| @@ -83,6 +83,7 @@ private: | |||||||
|  |  | ||||||
| struct ItemSortContainer; | struct ItemSortContainer; | ||||||
| typedef QSharedPointer< ItemSortContainer > PItemSortContainer; | typedef QSharedPointer< ItemSortContainer > PItemSortContainer; | ||||||
|  |  | ||||||
| class BandDesignIntf : public BaseDesignIntf | class BandDesignIntf : public BaseDesignIntf | ||||||
| { | { | ||||||
|     Q_OBJECT |     Q_OBJECT | ||||||
| @@ -210,6 +211,9 @@ public: | |||||||
|     bool startFromNewPage() const; |     bool startFromNewPage() const; | ||||||
|     void setStartFromNewPage(bool startFromNewPage); |     void setStartFromNewPage(bool startFromNewPage); | ||||||
|     bool canContainChildren(){ return true;} |     bool canContainChildren(){ return true;} | ||||||
|  |     bool printAlways() const; | ||||||
|  |     void setPrintAlways(bool printAlways); | ||||||
|  |  | ||||||
| signals: | signals: | ||||||
|     void bandRendered(BandDesignIntf* band); |     void bandRendered(BandDesignIntf* band); | ||||||
| protected: | protected: | ||||||
| @@ -260,6 +264,7 @@ private: | |||||||
|     bool                        m_reprintOnEachPage; |     bool                        m_reprintOnEachPage; | ||||||
|     bool                        m_startNewPage; |     bool                        m_startNewPage; | ||||||
|     bool                        m_startFromNewPage; |     bool                        m_startFromNewPage; | ||||||
|  |     bool                        m_printAlways; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| class DataBandDesignIntf : public BandDesignIntf{ | class DataBandDesignIntf : public BandDesignIntf{ | ||||||
|   | |||||||
| @@ -364,12 +364,18 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) | |||||||
|     if (dataBand && !dataBand->datasourceName().isEmpty()) |     if (dataBand && !dataBand->datasourceName().isEmpty()) | ||||||
|        bandDatasource = datasources()->dataSource(dataBand->datasourceName()); |        bandDatasource = datasources()->dataSource(dataBand->datasourceName()); | ||||||
|  |  | ||||||
|  |     BandDesignIntf* header = dataBand->bandHeader(); | ||||||
|  |     BandDesignIntf* footer = dataBand->bandFooter(); | ||||||
|  |  | ||||||
|  |     if (header && header->printAlways()) renderBand(header); | ||||||
|  |  | ||||||
|     if(bandDatasource && !bandDatasource->eof() && !m_renderCanceled){ |     if(bandDatasource && !bandDatasource->eof() && !m_renderCanceled){ | ||||||
|  |  | ||||||
|         QString varName = QLatin1String("line_")+dataBand->objectName().toLower(); |         QString varName = QLatin1String("line_")+dataBand->objectName().toLower(); | ||||||
|         datasources()->setReportVariable(varName,1); |         datasources()->setReportVariable(varName,1); | ||||||
|  |  | ||||||
|         renderBand(dataBand->bandHeader()); |         if (header && !header->printAlways()) | ||||||
|  |             renderBand(header); | ||||||
|  |  | ||||||
|         if (dataBand->bandHeader() && dataBand->bandHeader()->reprintOnEachPage()) |         if (dataBand->bandHeader() && dataBand->bandHeader()->reprintOnEachPage()) | ||||||
|             m_reprintableBands.append(dataBand->bandHeader()); |             m_reprintableBands.append(dataBand->bandHeader()); | ||||||
| @@ -416,11 +422,17 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) | |||||||
|  |  | ||||||
|         renderGroupFooter(dataBand); |         renderGroupFooter(dataBand); | ||||||
|  |  | ||||||
|         renderBand(dataBand->bandFooter(),StartNewPageAsNeeded); |         if (footer && !footer->printAlways()) | ||||||
|  |             renderBand(footer,StartNewPageAsNeeded); | ||||||
|  |  | ||||||
|         datasources()->deleteVariable(varName); |         datasources()->deleteVariable(varName); | ||||||
|  |  | ||||||
|     } else if (bandDatasource==0) { |     } else if (bandDatasource==0) { | ||||||
|         renderBand(dataBand,StartNewPageAsNeeded); |         renderBand(dataBand,StartNewPageAsNeeded); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if (footer && footer->printAlways()) | ||||||
|  |         renderBand(footer,StartNewPageAsNeeded); | ||||||
| } | } | ||||||
|  |  | ||||||
| void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage) | void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user