diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 4b5930b..a56cf9c 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -106,6 +106,7 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q m_dataSourceName(""), m_autoHeight(true), m_keepBottomSpace(false), + m_keepTopSpace(true), m_parentBand(0), m_parentBandName(""), m_bandMarker(0), @@ -821,6 +822,20 @@ void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QStrin m_bandNameLabel->updateLabel(newName); } +bool BandDesignIntf::keepTopSpace() const +{ + return m_keepTopSpace; +} + +void BandDesignIntf::setKeepTopSpace(bool value) +{ + if (m_keepTopSpace != value){ + m_keepTopSpace = value; + if (!isLoading()) + notify("keepTopSpace",!value,value); + } +} + bool BandDesignIntf::repeatOnEachRow() const { return m_repeatOnEachRow; @@ -969,9 +984,14 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p } restoreLinks(); snapshotItemsLayout(); - arrangeSubItems(pass, dataManager); + arrangeSubItems(pass, dataManager); if (autoHeight()){ - //if keepBottomSpace()&& height()setY(item->y() - minTop); + } + } setHeight(findMaxBottom()+spaceBorder); } if ((maxHeight>0)&&(height()>maxHeight)){ diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index aa1674d..6a0fb9a 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -100,6 +100,7 @@ class BandDesignIntf : public ItemsContainerDesignInft 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 keepTopSpace READ keepTopSpace WRITE setKeepTopSpace) Q_PROPERTY(QString parentBand READ parentBandName WRITE setParentBandName DESIGNABLE false ) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) @@ -155,6 +156,9 @@ public: void setKeepBottomSpaceOption(bool value); bool keepBottomSpaceOption() const {return m_keepBottomSpace;} + bool keepTopSpace() const; + void setKeepTopSpace(bool value); + void addChildBand(BandDesignIntf* band); bool hasChildren(){return !m_childBands.isEmpty();} void removeChildBand(BandDesignIntf* band); @@ -245,7 +249,7 @@ public: void copyBookmarks(BandDesignIntf* sourceBand); signals: - void bandRendered(BandDesignIntf* band); + void bandRendered(BandDesignIntf* band); void bandRegistred(); protected: void trimToMaxHeight(int maxHeight); @@ -279,6 +283,7 @@ private: QString m_dataSourceName; bool m_autoHeight; bool m_keepBottomSpace; + bool m_keepTopSpace; BandDesignIntf* m_parentBand; QString m_parentBandName; QList m_childBands; diff --git a/limereport/lritemscontainerdesignitf.cpp b/limereport/lritemscontainerdesignitf.cpp index 0e31eb8..ea5eafc 100644 --- a/limereport/lritemscontainerdesignitf.cpp +++ b/limereport/lritemscontainerdesignitf.cpp @@ -93,16 +93,27 @@ void ItemsContainerDesignInft::arrangeSubItems(RenderPass pass, DataSourceManage qreal ItemsContainerDesignInft::findMaxBottom() const { - qreal maxBottom=0; + qreal maxBottom = 0; foreach(QGraphicsItem* item,childItems()){ BaseDesignIntf* subItem = dynamic_cast(item); if(subItem) if ( subItem->isVisible() && (subItem->geometry().bottom()>maxBottom) ) - maxBottom=subItem->geometry().bottom(); + maxBottom = subItem->geometry().bottom(); } return maxBottom; } +qreal ItemsContainerDesignInft::findMinTop() const{ + qreal minTop = height(); + foreach(QGraphicsItem* item,childItems()){ + BaseDesignIntf* subItem = dynamic_cast(item); + if(subItem) + if ( subItem->isVisible() && (subItem->geometry().top()geometry().top(); + } + return minTop > 0 ? minTop : 0; +} + qreal ItemsContainerDesignInft::findMaxHeight() const { qreal maxHeight=0; diff --git a/limereport/lritemscontainerdesignitf.h b/limereport/lritemscontainerdesignitf.h index 1526ac7..ff5c2e2 100644 --- a/limereport/lritemscontainerdesignitf.h +++ b/limereport/lritemscontainerdesignitf.h @@ -46,6 +46,7 @@ protected: void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded); qreal findMaxBottom() const; qreal findMaxHeight() const; + qreal findMinTop() const; private: QVector m_containerItems;