0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 17:14:40 +03:00

Context items added to pagefooter band

This commit is contained in:
Arin Alexander 2018-03-15 23:35:29 +03:00
parent 7c92ecfc5f
commit 3f96bf298e
2 changed files with 39 additions and 4 deletions

View File

@ -30,6 +30,7 @@
#include "lrpagefooter.h" #include "lrpagefooter.h"
#include "lrdesignelementsfactory.h" #include "lrdesignelementsfactory.h"
#include "lrglobal.h" #include "lrglobal.h"
#include "lrpagedesignintf.h"
const QString xmlTag ="PageFooter"; const QString xmlTag ="PageFooter";
@ -65,6 +66,28 @@ QColor PageFooter::bandColor() const
return QColor(246,120,12); return QColor(246,120,12);
} }
void PageFooter::preparePopUpMenu(QMenu &menu)
{
QAction* action = menu.addAction(tr("Print on first page"));
action->setCheckable(true);
action->setChecked(printOnFirstPage());
action = menu.addAction(tr("Print on last page"));
action->setCheckable(true);
action->setChecked(printOnLastPage());
}
void PageFooter::processPopUpAction(QAction *action)
{
if (action->text().compare(tr("Print on first page")) == 0){
page()->setPropertyToSelectedItems("printOnFirstPage",action->isChecked());
}
if (action->text().compare(tr("Print on last page")) == 0){
page()->setPropertyToSelectedItems("printOnLastPage",action->isChecked());
}
}
bool PageFooter::printOnFirstPage() const bool PageFooter::printOnFirstPage() const
{ {
return m_printOnFirstPage; return m_printOnFirstPage;
@ -72,7 +95,12 @@ bool PageFooter::printOnFirstPage() const
void PageFooter::setPrintOnFirstPage(bool printOnFirstPage) void PageFooter::setPrintOnFirstPage(bool printOnFirstPage)
{ {
if (m_printOnFirstPage != printOnFirstPage){
bool oldValue = m_printOnFirstPage;
m_printOnFirstPage = printOnFirstPage; m_printOnFirstPage = printOnFirstPage;
update();
notify("printOnFirstPage",oldValue,printOnFirstPage);
}
} }
bool PageFooter::printOnLastPage() const bool PageFooter::printOnLastPage() const
@ -82,7 +110,12 @@ bool PageFooter::printOnLastPage() const
void PageFooter::setPrintOnLastPage(bool printOnLastPage) void PageFooter::setPrintOnLastPage(bool printOnLastPage)
{ {
if (m_printOnLastPage != printOnLastPage){
bool oldValue = m_printOnLastPage;
m_printOnLastPage = printOnLastPage; m_printOnLastPage = printOnLastPage;
update();
notify("printOnLastPage",oldValue,printOnLastPage);
}
} }
} // namespace LimeReport } // namespace LimeReport

View File

@ -51,6 +51,8 @@ public:
protected: protected:
QColor bandColor() const; QColor bandColor() const;
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
private: private:
bool m_printOnFirstPage; bool m_printOnFirstPage;
bool m_printOnLastPage; bool m_printOnLastPage;