0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 00:33:02 +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 "lrdesignelementsfactory.h"
#include "lrglobal.h"
#include "lrpagedesignintf.h"
const QString xmlTag ="PageFooter";
@ -62,7 +63,29 @@ BaseDesignIntf *PageFooter::createSameTypeItem(QObject *owner, QGraphicsItem *pa
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
@ -72,7 +95,12 @@ bool PageFooter::printOnFirstPage() const
void PageFooter::setPrintOnFirstPage(bool printOnFirstPage)
{
m_printOnFirstPage = printOnFirstPage;
if (m_printOnFirstPage != printOnFirstPage){
bool oldValue = m_printOnFirstPage;
m_printOnFirstPage = printOnFirstPage;
update();
notify("printOnFirstPage",oldValue,printOnFirstPage);
}
}
bool PageFooter::printOnLastPage() const
@ -82,7 +110,12 @@ bool PageFooter::printOnLastPage() const
void PageFooter::setPrintOnLastPage(bool printOnLastPage)
{
m_printOnLastPage = printOnLastPage;
if (m_printOnLastPage != printOnLastPage){
bool oldValue = m_printOnLastPage;
m_printOnLastPage = printOnLastPage;
update();
notify("printOnLastPage",oldValue,printOnLastPage);
}
}
} // namespace LimeReport

View File

@ -50,7 +50,9 @@ public:
void setPrintOnFirstPage(bool printOnFirstPage);
protected:
QColor bandColor() const;
QColor bandColor() const;
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
private:
bool m_printOnFirstPage;
bool m_printOnLastPage;