0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

Generating unique names for page items has been added

This commit is contained in:
Arin Alexander 2016-05-26 23:21:42 +04:00
parent 8d3dd7c09b
commit c9d378a927
2 changed files with 15 additions and 5 deletions

View File

@ -139,6 +139,13 @@ qreal ReportRender::maxColumnHeight()
return result;
}
void ReportRender::renameChildItems(BaseDesignIntf *item){
foreach(BaseDesignIntf* child, item->childBaseItems()){
if (!child->childBaseItems().isEmpty()) renameChildItems(child);
child->setObjectName(child->metaObject()->className()+QString::number(++m_curentNameIndex));
}
}
ReportRender::ReportRender(QObject *parent)
:QObject(parent), m_renderPageItem(0), m_pageCount(0), m_currentColumn(0),
m_lastDataBand(0), m_lastRenderedFooter(0)
@ -163,6 +170,7 @@ void ReportRender::initDatasources(){
void ReportRender::renderPage(PageDesignIntf* patternPage)
{
m_curentNameIndex = 0;
m_patternPageItem = patternPage->pageItem();
m_pageCount = 1;
m_renderCanceled = false;
@ -728,6 +736,8 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren)
}
if (band->isData()) m_renderedDataBandCount++;
band->setObjectName(band->objectName()+QString::number(++m_curentNameIndex));
renameChildItems(band);
return true;
} else return false;
}

View File

@ -74,7 +74,6 @@ public:
ReportRender(QObject *parent = 0);
void setDatasources(DataSourceManager* value);
DataSourceManager* datasources(){return m_datasources;}
void renderPage(PageDesignIntf *patternPage);
int pageCount();
PageItemDesignIntf::Ptr pageAt(int index);
QString renderPageToString(PageDesignIntf *patternPage);
@ -84,6 +83,7 @@ signals:
public slots:
void cancelRender();
private:
void renderPage(PageDesignIntf *patternPage);
void initDatasources();
void initRenderPage();
void initVariables();
@ -131,8 +131,6 @@ private:
int findLastPageNumber(int currentPage);
void savePage();
QString toString();
private:
void initColumns();
bool isNeedToRearrangeColumnsItems();
BandDesignIntf* lastColumnItem(int columnIndex);
@ -140,6 +138,7 @@ private:
int columnItemsCount(int columnIndex);
qreal columnHeigth(int columnIndex);
qreal maxColumnHeight();
void renameChildItems(BaseDesignIntf *item);
private:
DataSourceManager* m_datasources;
PageItemDesignIntf* m_renderPageItem;
@ -169,6 +168,7 @@ private:
int m_currentColumn;
QList<PagesRange> m_ranges;
QVector<BandDesignIntf*> m_columnedBandItems;
unsigned long long m_curentNameIndex;
};
} // namespace LimeReport
#endif // LRREPORTRENDER_H