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; 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) ReportRender::ReportRender(QObject *parent)
:QObject(parent), m_renderPageItem(0), m_pageCount(0), m_currentColumn(0), :QObject(parent), m_renderPageItem(0), m_pageCount(0), m_currentColumn(0),
m_lastDataBand(0), m_lastRenderedFooter(0) m_lastDataBand(0), m_lastRenderedFooter(0)
@ -163,8 +170,9 @@ void ReportRender::initDatasources(){
void ReportRender::renderPage(PageDesignIntf* patternPage) void ReportRender::renderPage(PageDesignIntf* patternPage)
{ {
m_patternPageItem=patternPage->pageItem(); m_curentNameIndex = 0;
m_pageCount=1; m_patternPageItem = patternPage->pageItem();
m_pageCount = 1;
m_renderCanceled = false; m_renderCanceled = false;
BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter); BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter);
m_reportFooterHeight = 0; m_reportFooterHeight = 0;
@ -728,6 +736,8 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren)
} }
if (band->isData()) m_renderedDataBandCount++; if (band->isData()) m_renderedDataBandCount++;
band->setObjectName(band->objectName()+QString::number(++m_curentNameIndex));
renameChildItems(band);
return true; return true;
} else return false; } else return false;
} }

View File

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