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 "lritemdesignintf.h"
#include "lrbanddesignintf.h"
namespace LimeReport {
@ -37,11 +38,15 @@ bool itemSortContainerLessThen(const PItemSortContainer c1, const PItemSortConta
else return c1->m_rect.y()<c2->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<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);
}

View File

@ -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;

View File

@ -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