From 09e95cd63351f7f0138ecd7e542bcac1967f105a Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 31 Jul 2019 00:28:45 +0300 Subject: [PATCH] Drawing of report items borders has been fixed --- common.pri | 2 +- limereport/lrbanddesignintf.cpp | 23 +++++++++++++++-------- limereport/lrbanddesignintf.h | 6 +++--- limereport/lrbasedesignintf.cpp | 4 +++- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/common.pri b/common.pri index 3dcb931..e76450d 100644 --- a/common.pri +++ b/common.pri @@ -127,7 +127,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 5 -LIMEREPORT_VERSION_RELEASE = 5 +LIMEREPORT_VERSION_RELEASE = 6 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index caac574..d8a6bbb 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -356,7 +356,7 @@ void BandDesignIntf::setDataSourceName(const QString &datasource){ m_dataSourceName=datasource; } -void BandDesignIntf::setKeepBottomSpaceOption(bool value){ +void BandDesignIntf::setKeepBottomSpace(bool value){ if (m_keepBottomSpace!=value){ m_keepBottomSpace=value; if (!isLoading()) @@ -584,7 +584,11 @@ void BandDesignIntf::preparePopUpMenu(QMenu &menu) currAction = menu.addAction(tr("Keep bottom space")); currAction->setCheckable(true); - currAction->setChecked(keepBottomSpaceOption()); + currAction->setChecked(keepBottomSpace()); + + currAction = menu.addAction(tr("Keep top space")); + currAction->setCheckable(true); + currAction->setChecked(keepTopSpace()); currAction = menu.addAction(tr("Print if empty")); currAction->setCheckable(true); @@ -603,6 +607,9 @@ void BandDesignIntf::processPopUpAction(QAction *action) if (action->text().compare(tr("Keep bottom space")) == 0){ setProperty("keepBottomSpace",action->isChecked()); } + if (action->text().compare(tr("Keep top space")) == 0){ + setProperty("keepTopSpace",action->isChecked()); + } if (action->text().compare(tr("Print if empty")) == 0){ setProperty("printIfEmpty",action->isChecked()); @@ -1090,10 +1097,10 @@ void BandDesignIntf::setKeepFooterTogether(bool value) void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight) { - qreal spaceBorder=0; - if (keepBottomSpaceOption()) spaceBorder = bottomSpace(); + qreal spaceBorder = 0; + if (keepBottomSpace()) spaceBorder = bottomSpace(); spaceBorder = spaceBorder > 0 ? spaceBorder : 0; - if (borderLines()!=0){ + if (borderLines() != 0){ spaceBorder += borderLineSize(); } @@ -1105,14 +1112,14 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p arrangeSubItems(pass, dataManager); if (autoHeight()){ if (!keepTopSpace()) { - qreal minTop = findMinTop(); + qreal minTop = findMinTop() - spaceBorder; foreach (BaseDesignIntf* item, childBaseItems()) { item->setY(item->y() - minTop); } } - setHeight(findMaxBottom()+spaceBorder); + setHeight(findMaxBottom() + spaceBorder); } - if ((maxHeight>0)&&(height()>maxHeight)){ + if ((maxHeight > 0) && (height() > maxHeight)){ trimToMaxHeight(maxHeight); setHeight(maxHeight); } diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index a6e09be..3f4f5f7 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -105,7 +105,7 @@ class BandDesignIntf : public ItemsContainerDesignInft Q_OBJECT Q_PROPERTY(bool autoHeight READ autoHeight WRITE setAutoHeight ) Q_PROPERTY(int bandIndex READ bandIndex WRITE setBandIndex DESIGNABLE false ) - Q_PROPERTY(bool keepBottomSpace READ keepBottomSpaceOption WRITE setKeepBottomSpaceOption ) + Q_PROPERTY(bool keepBottomSpace READ keepBottomSpace WRITE setKeepBottomSpace ) Q_PROPERTY(bool keepTopSpace READ keepTopSpace WRITE setKeepTopSpace) Q_PROPERTY(QString parentBand READ parentBandName WRITE setParentBandName DESIGNABLE false ) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) @@ -162,8 +162,8 @@ public: QString datasourceName(); void setDataSourceName(const QString& datasourceName); - void setKeepBottomSpaceOption(bool value); - bool keepBottomSpaceOption() const {return m_keepBottomSpace;} + void setKeepBottomSpace(bool value); + bool keepBottomSpace() const {return m_keepBottomSpace;} bool keepTopSpace() const; void setKeepTopSpace(bool value); diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 71f2f94..1555aaf 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -97,7 +97,9 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q QRectF BaseDesignIntf::boundingRect() const { - return rect(); + qreal halfpw = pen().widthF() / 2; + halfpw += 2; + return rect().adjusted(-halfpw, -halfpw, halfpw, halfpw); } BaseDesignIntf::~BaseDesignIntf(void) {