mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 20:22:58 +03:00
notPrintIfEmpty has been added to page item
This commit is contained in:
parent
22ab25d6c6
commit
4bbc85b79e
@ -52,7 +52,8 @@ PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) :
|
||||
m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false),
|
||||
m_isExtendedInDesignMode(false), m_extendedHeight(1000), m_isTOC(false),
|
||||
m_setPageSizeToPrinter(false), m_endlessHeight(false), m_printable(true),
|
||||
m_pageFooter(0), m_printBehavior(Split), m_dropPrinterMargins(false)
|
||||
m_pageFooter(0), m_printBehavior(Split), m_dropPrinterMargins(false),
|
||||
m_notPrintIfEmpty(false)
|
||||
{
|
||||
setFixedPos(true);
|
||||
setPossibleResizeDirectionFlags(Fixed);
|
||||
@ -67,7 +68,8 @@ PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &re
|
||||
m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false),
|
||||
m_isExtendedInDesignMode(false), m_extendedHeight(1000), m_isTOC(false),
|
||||
m_setPageSizeToPrinter(false), m_endlessHeight(false), m_printable(true),
|
||||
m_pageFooter(0), m_printBehavior(Split), m_dropPrinterMargins(false)
|
||||
m_pageFooter(0), m_printBehavior(Split), m_dropPrinterMargins(false),
|
||||
m_notPrintIfEmpty(false)
|
||||
{
|
||||
setFixedPos(true);
|
||||
setPossibleResizeDirectionFlags(Fixed);
|
||||
@ -348,6 +350,16 @@ void PageItemDesignIntf::initColumnsPos(QVector<qreal> &posByColumns, qreal pos,
|
||||
}
|
||||
}
|
||||
|
||||
bool PageItemDesignIntf::notPrintIfEmpty() const
|
||||
{
|
||||
return m_notPrintIfEmpty;
|
||||
}
|
||||
|
||||
void PageItemDesignIntf::setNotPrintIfEmpty(bool notPrintIfEmpty)
|
||||
{
|
||||
m_notPrintIfEmpty = notPrintIfEmpty;
|
||||
}
|
||||
|
||||
bool PageItemDesignIntf::dropPrinterMargins() const
|
||||
{
|
||||
return m_dropPrinterMargins;
|
||||
@ -358,6 +370,11 @@ void PageItemDesignIntf::setDropPrinterMargins(bool dropPrinterMargins)
|
||||
m_dropPrinterMargins = dropPrinterMargins;
|
||||
}
|
||||
|
||||
bool PageItemDesignIntf::isEmpty() const
|
||||
{
|
||||
return childBaseItems().isEmpty();
|
||||
}
|
||||
|
||||
void PageItemDesignIntf::setPrintBehavior(const PrintBehavior &printBehavior)
|
||||
{
|
||||
m_printBehavior = printBehavior;
|
||||
|
@ -62,6 +62,7 @@ class PageItemDesignIntf : public ItemsContainerDesignInft
|
||||
Q_PROPERTY(UnitType units READ unitType WRITE setUnitTypeProperty)
|
||||
Q_PROPERTY(PrintBehavior printBehavior READ printBehavior WRITE setPrintBehavior)
|
||||
Q_PROPERTY(bool dropPrinterMargins READ dropPrinterMargins WRITE setDropPrinterMargins)
|
||||
Q_PROPERTY(bool notPrintIfEmpty READ notPrintIfEmpty WRITE setNotPrintIfEmpty)
|
||||
friend class ReportRender;
|
||||
public:
|
||||
enum Orientation { Portrait = QPrinter::Portrait, Landscape = QPrinter::Landscape };
|
||||
@ -182,6 +183,11 @@ public:
|
||||
bool dropPrinterMargins() const;
|
||||
void setDropPrinterMargins(bool dropPrinterMargins);
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
bool notPrintIfEmpty() const;
|
||||
void setNotPrintIfEmpty(bool notPrintIfEmpty);
|
||||
|
||||
signals:
|
||||
void beforeFirstPageRendered();
|
||||
void afterLastPageRendered();
|
||||
@ -226,6 +232,7 @@ private:
|
||||
BandDesignIntf* m_pageFooter;
|
||||
PrintBehavior m_printBehavior;
|
||||
bool m_dropPrinterMargins;
|
||||
bool m_notPrintIfEmpty;
|
||||
|
||||
|
||||
};
|
||||
|
@ -1483,15 +1483,19 @@ BandDesignIntf* ReportRender::findEnclosingGroup()
|
||||
|
||||
void ReportRender::savePage(bool isLast)
|
||||
{
|
||||
if (m_renderPageItem->isTOC())
|
||||
m_pagesRanges.addTOCPage();
|
||||
else
|
||||
m_pagesRanges.addPage();
|
||||
|
||||
m_datasources->setReportVariable("#IS_LAST_PAGEFOOTER",isLast);
|
||||
m_datasources->setReportVariable("#IS_FIRST_PAGEFOOTER",m_datasources->variable("#PAGE").toInt()==1);
|
||||
|
||||
renderPageItems(m_patternPageItem);
|
||||
|
||||
if (m_renderPageItem->isEmpty() and m_renderPageItem->notPrintIfEmpty()) return;
|
||||
|
||||
if (m_renderPageItem->isTOC())
|
||||
m_pagesRanges.addTOCPage();
|
||||
else
|
||||
m_pagesRanges.addPage();
|
||||
|
||||
checkFooterGroup(m_lastDataBand);
|
||||
cutGroups();
|
||||
rearrangeColumnsItems();
|
||||
|
Loading…
Reference in New Issue
Block a user