From 072b6233980a3467c7aae8cb8c3aee75e89a4c4c Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 20 Jun 2018 18:47:59 +0300 Subject: [PATCH] Band popup menu fixed --- common.pri | 2 +- limereport/bands/lrdataband.cpp | 20 ++++++++++++- limereport/lrbanddesignintf.cpp | 53 +++++++++++++++++++++++---------- 3 files changed, 57 insertions(+), 18 deletions(-) diff --git a/common.pri b/common.pri index 3020408..0e2ae3e 100644 --- a/common.pri +++ b/common.pri @@ -62,7 +62,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 80 +LIMEREPORT_VERSION_RELEASE = 83 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/bands/lrdataband.cpp b/limereport/bands/lrdataband.cpp index fbb0ae8..29cea5e 100644 --- a/limereport/bands/lrdataband.cpp +++ b/limereport/bands/lrdataband.cpp @@ -99,6 +99,16 @@ void DataBand::preparePopUpMenu(QMenu &menu) currAction->setCheckable(true); currAction->setChecked(sliceLastRow()); + currAction = menu.addAction(tr("Start from new page")); + currAction->setCheckable(true); + currAction->setChecked(startFromNewPage()); + + currAction = menu.addAction(tr("Start new page")); + currAction->setCheckable(true); + currAction->setChecked(startNewPage()); + + + } void DataBand::processPopUpAction(QAction *action) @@ -116,6 +126,14 @@ void DataBand::processPopUpAction(QAction *action) setProperty("sliceLastRow",action->isChecked()); } + if (action->text().compare(tr("Start new page")) == 0){ + setProperty("startNewPage",action->isChecked()); + } + + if (action->text().compare(tr("Start from new page")) == 0){ + setProperty("startFromNewPage",action->isChecked()); + } + } BaseDesignIntf *DataBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent) @@ -150,7 +168,7 @@ void DataHeaderBand::processPopUpAction(QAction *action) { BandDesignIntf::processPopUpAction(action); if (action->text().compare(tr("Reprint on each page")) == 0){ - setProperty("repeatOnEachPage",action->isChecked()); + setProperty("reprintOnEachPage",action->isChecked()); } if (action->text().compare(tr("Repeat on each row")) == 0){ diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index edc0c45..56c2642 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -428,7 +428,11 @@ bool BandDesignIntf::isNeedRender() const void BandDesignIntf::setTryToKeepTogether(bool value) { - m_tryToKeepTogether=value; + if (m_tryToKeepTogether != value){ + m_tryToKeepTogether = value; + if (!isLoading()) + notify("keepSubdetailTogether", !value, value); + } } bool BandDesignIntf::tryToKeepTogether() @@ -497,6 +501,7 @@ void BandDesignIntf::preparePopUpMenu(QMenu &menu) currAction->setChecked(autoHeight()); currAction = menu.addAction(tr("Splittable")); + currAction->setEnabled(metaObject()->indexOfProperty("splittable") != -1); currAction->setCheckable(true); currAction->setChecked(isSplittable()); @@ -504,13 +509,10 @@ void BandDesignIntf::preparePopUpMenu(QMenu &menu) currAction->setCheckable(true); currAction->setChecked(keepBottomSpaceOption()); - currAction = menu.addAction(tr("Start from new page")); + currAction = menu.addAction(tr("Print if empty")); currAction->setCheckable(true); - currAction->setChecked(startFromNewPage()); + currAction->setChecked(printIfEmpty()); - currAction = menu.addAction(tr("Start new page")); - currAction->setCheckable(true); - currAction->setChecked(startNewPage()); } void BandDesignIntf::processPopUpAction(QAction *action) @@ -524,12 +526,10 @@ void BandDesignIntf::processPopUpAction(QAction *action) if (action->text().compare(tr("Keep bottom space")) == 0){ setProperty("keepBottomSpace",action->isChecked()); } - if (action->text().compare(tr("Start new page")) == 0){ - setProperty("startNewPage",action->isChecked()); - } - if (action->text().compare(tr("Start from new page")) == 0){ - setProperty("startFromNewPage",action->isChecked()); + if (action->text().compare(tr("Print if empty")) == 0){ + setProperty("printIfEmpty",action->isChecked()); } + } BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) @@ -798,7 +798,11 @@ bool BandDesignIntf::repeatOnEachRow() const void BandDesignIntf::setRepeatOnEachRow(bool repeatOnEachRow) { - m_repeatOnEachRow = repeatOnEachRow; + if (m_repeatOnEachRow != repeatOnEachRow){ + m_repeatOnEachRow = repeatOnEachRow; + if (!isLoading()) + notify("repeatOnEachRow", !m_repeatOnEachRow, m_repeatOnEachRow); + } } bool BandDesignIntf::printAlways() const @@ -808,7 +812,11 @@ bool BandDesignIntf::printAlways() const void BandDesignIntf::setPrintAlways(bool printAlways) { - m_printAlways = printAlways; + if (m_printAlways != printAlways){ + m_printAlways = printAlways; + if (!isLoading()) + notify("printAlways", !m_printAlways, m_printAlways); + } } bool BandDesignIntf::startFromNewPage() const @@ -854,7 +862,11 @@ bool BandDesignIntf::reprintOnEachPage() const void BandDesignIntf::setReprintOnEachPage(bool reprintOnEachPage) { - m_reprintOnEachPage = reprintOnEachPage; + if (m_reprintOnEachPage != reprintOnEachPage){ + m_reprintOnEachPage = reprintOnEachPage; + if (!isLoading()) + notify("reprintOnEachPage", !m_reprintOnEachPage, m_reprintOnEachPage); + } } int BandDesignIntf::columnIndex() const @@ -874,7 +886,12 @@ bool BandDesignIntf::printIfEmpty() const void BandDesignIntf::setPrintIfEmpty(bool printIfEmpty) { - m_printIfEmpty = printIfEmpty; + if (m_printIfEmpty != printIfEmpty){ + m_printIfEmpty = printIfEmpty; + if (!isLoading()) + notify("printIfEmpty", !m_printIfEmpty, m_printIfEmpty); + } + } BandDesignIntf *BandDesignIntf::bandHeader() @@ -903,7 +920,11 @@ bool BandDesignIntf::sliceLastRow() const void BandDesignIntf::setSliceLastRow(bool sliceLastRow) { - m_sliceLastRow = sliceLastRow; + if (m_sliceLastRow != sliceLastRow){ + m_sliceLastRow = sliceLastRow; + if (!isLoading()) + notify("sliceLastRow", !sliceLastRow, sliceLastRow); + } } int BandDesignIntf::maxScalePercent() const