From d6fe74e29e118bd30912e0b68520902687d716fe Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Sat, 20 Jun 2020 10:10:53 +0300 Subject: [PATCH] Finish endless_optimization --- limereport/lritemscontainerdesignitf.cpp | 11 ++++++++--- limereport/lritemscontainerdesignitf.h | 3 ++- limereport/lrpageitemdesignintf.cpp | 9 ++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/limereport/lritemscontainerdesignitf.cpp b/limereport/lritemscontainerdesignitf.cpp index ea5eafc..836fbea 100644 --- a/limereport/lritemscontainerdesignitf.cpp +++ b/limereport/lritemscontainerdesignitf.cpp @@ -1,5 +1,6 @@ #include "lritemscontainerdesignitf.h" #include "lritemdesignintf.h" +#include "lrbanddesignintf.h" namespace LimeReport { @@ -37,11 +38,15 @@ bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortConta else return c1->m_rect.y()m_rect.y(); } -void ItemsContainerDesignInft::snapshotItemsLayout() +void ItemsContainerDesignInft::snapshotItemsLayout(SnapshotType type) { m_containerItems.clear(); - foreach(BaseDesignIntf *childItem,childBaseItems()){ - m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem))); + foreach(BaseDesignIntf *childItem, childBaseItems()){ + if (type == IgnoreBands){ + if (!dynamic_cast(childItem)) + m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem))); + } else + m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem))); } qSort(m_containerItems.begin(),m_containerItems.end(),itemSortContainerLessThen); } diff --git a/limereport/lritemscontainerdesignitf.h b/limereport/lritemscontainerdesignitf.h index b9aa421..483bf95 100644 --- a/limereport/lritemscontainerdesignitf.h +++ b/limereport/lritemscontainerdesignitf.h @@ -42,8 +42,9 @@ class ItemsContainerDesignInft : public BookmarkContainerDesignIntf{ public: ItemsContainerDesignInft(const QString& xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0): BookmarkContainerDesignIntf(xmlTypeName, owner, parent){} + enum SnapshotType{Full, IgnoreBands}; protected: - void snapshotItemsLayout(); + void snapshotItemsLayout(SnapshotType type = Full); void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded); qreal findMaxBottom() const; qreal findMaxHeight() const; diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index f65c085..3bcb402 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -131,7 +131,8 @@ BaseDesignIntf *PageItemDesignIntf::createSameTypeItem(QObject *owner, QGraphics void PageItemDesignIntf::geometryChangedEvent(QRectF newRect, QRectF) { Q_UNUSED(newRect) - updateMarginRect(); + if (itemMode() == DesignMode || !endlessHeight()) + updateMarginRect(); PageSize oldSize = m_pageSize; if (!m_sizeChainging && !isLoading()) m_pageSize = Custom; @@ -490,8 +491,10 @@ void PageItemDesignIntf::setResetPageNumber(bool resetPageNumber) void PageItemDesignIntf::updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager) { - snapshotItemsLayout(); - arrangeSubItems(pass, dataManager); + if (!endlessHeight()){ + snapshotItemsLayout(IgnoreBands); + arrangeSubItems(pass, dataManager); + } } bool PageItemDesignIntf::oldPrintMode() const