0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

Finish endless_optimization

This commit is contained in:
Arin Alexander 2020-06-20 10:10:53 +03:00
parent 8dedda7c9c
commit d6fe74e29e
3 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,6 @@
#include "lritemscontainerdesignitf.h" #include "lritemscontainerdesignitf.h"
#include "lritemdesignintf.h" #include "lritemdesignintf.h"
#include "lrbanddesignintf.h"
namespace LimeReport { namespace LimeReport {
@ -37,11 +38,15 @@ bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortConta
else return c1->m_rect.y()<c2->m_rect.y(); else return c1->m_rect.y()<c2->m_rect.y();
} }
void ItemsContainerDesignInft::snapshotItemsLayout() void ItemsContainerDesignInft::snapshotItemsLayout(SnapshotType type)
{ {
m_containerItems.clear(); m_containerItems.clear();
foreach(BaseDesignIntf *childItem,childBaseItems()){ foreach(BaseDesignIntf *childItem, childBaseItems()){
m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem))); if (type == IgnoreBands){
if (!dynamic_cast<BandDesignIntf*>(childItem))
m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem)));
} else
m_containerItems.append(PItemSortContainer(new ItemSortContainer(childItem)));
} }
qSort(m_containerItems.begin(),m_containerItems.end(),itemSortContainerLessThen); qSort(m_containerItems.begin(),m_containerItems.end(),itemSortContainerLessThen);
} }

View File

@ -42,8 +42,9 @@ class ItemsContainerDesignInft : public BookmarkContainerDesignIntf{
public: public:
ItemsContainerDesignInft(const QString& xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0): ItemsContainerDesignInft(const QString& xmlTypeName, QObject* owner = 0, QGraphicsItem* parent=0):
BookmarkContainerDesignIntf(xmlTypeName, owner, parent){} BookmarkContainerDesignIntf(xmlTypeName, owner, parent){}
enum SnapshotType{Full, IgnoreBands};
protected: protected:
void snapshotItemsLayout(); void snapshotItemsLayout(SnapshotType type = Full);
void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded); void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded);
qreal findMaxBottom() const; qreal findMaxBottom() const;
qreal findMaxHeight() const; qreal findMaxHeight() const;

View File

@ -131,7 +131,8 @@ BaseDesignIntf *PageItemDesignIntf::createSameTypeItem(QObject *owner, QGraphics
void PageItemDesignIntf::geometryChangedEvent(QRectF newRect, QRectF) void PageItemDesignIntf::geometryChangedEvent(QRectF newRect, QRectF)
{ {
Q_UNUSED(newRect) Q_UNUSED(newRect)
updateMarginRect(); if (itemMode() == DesignMode || !endlessHeight())
updateMarginRect();
PageSize oldSize = m_pageSize; PageSize oldSize = m_pageSize;
if (!m_sizeChainging && !isLoading()) if (!m_sizeChainging && !isLoading())
m_pageSize = Custom; m_pageSize = Custom;
@ -490,8 +491,10 @@ void PageItemDesignIntf::setResetPageNumber(bool resetPageNumber)
void PageItemDesignIntf::updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager) void PageItemDesignIntf::updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager)
{ {
snapshotItemsLayout(); if (!endlessHeight()){
arrangeSubItems(pass, dataManager); snapshotItemsLayout(IgnoreBands);
arrangeSubItems(pass, dataManager);
}
} }
bool PageItemDesignIntf::oldPrintMode() const bool PageItemDesignIntf::oldPrintMode() const