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

Using group functions in the horizontal layout items has been fixed

This commit is contained in:
Arin Alexander 2017-06-13 17:48:59 +03:00
commit ab7394eacf
2 changed files with 72 additions and 50 deletions

View File

@ -330,11 +330,8 @@ void ReportRender::clearPageMap()
m_renderedPages.clear();
}
void ReportRender::extractGroupsFunction(BandDesignIntf *band)
{
foreach(BaseDesignIntf* item,band->childBaseItems()){
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem&&(contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}")))){
void ReportRender::extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band){
if ( contentItem && contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}"))){
foreach(const QString &functionName, m_datasources->groupFunctionNames()){
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
QRegExp rxName(QString(Const::GROUP_FUNCTION_NAME_RX).arg(functionName));
@ -363,14 +360,23 @@ void ReportRender::extractGroupsFunction(BandDesignIntf *band)
}
}
}
}
void ReportRender::extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band){
foreach (BaseDesignIntf* item, baseItem->childBaseItems()) {
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem) extractGroupFuntionsFromItem(contentItem, band);
else extractGroupFunctionsFromContainer(item, band);
}
}
void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
void ReportRender::extractGroupFunctions(BandDesignIntf *band)
{
foreach(BaseDesignIntf* item,band->childBaseItems()){
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
extractGroupFunctionsFromContainer(band, band);
}
void ReportRender::replaceGroupFunctionsInItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band){
if (contentItem){
QString content = contentItem->content();
foreach(const QString &functionName, m_datasources->groupFunctionNames()){
@ -389,9 +395,22 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
}
}
}
}
void ReportRender::replaceGroupFunctionsInContainer(BaseDesignIntf* baseItem, BandDesignIntf* band)
{
foreach(BaseDesignIntf* item, baseItem->childBaseItems()){
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem) replaceGroupFunctionsInItem(contentItem, band);
else replaceGroupFunctionsInContainer(item, band);
}
}
void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
{
replaceGroupFunctionsInContainer(band, band);
}
BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesignIntf* bandData, ReportRender::DataRenderMode mode, bool isLast)
{
QApplication::processEvents();
@ -748,7 +767,7 @@ void ReportRender::initGroups()
{
m_datasources->clearGroupFunction();
foreach(BandDesignIntf* band, m_patternPageItem->childBands()){
if (band->isFooter()) extractGroupsFunction(band);
if (band->isFooter()) extractGroupFunctions(band);
if (band->isHeader()){
IGroupBand* gb = dynamic_cast<IGroupBand*>(band);
if (gb) gb->closeGroup();

View File

@ -40,6 +40,7 @@ namespace LimeReport{
class PageDesignIntf;
class BandDesignIntf;
class ContentItemDesignIntf;
class GroupBandsHolder: public QList<BandDesignIntf*>{
public:
@ -86,9 +87,7 @@ signals:
public slots:
void cancelRender();
private:
void baseDesignIntfToScript(BaseDesignIntf* item);
void renderPage(PageDesignIntf *patternPage);
void initDatasources();
void initDatasource(const QString &name);
@ -112,9 +111,12 @@ private:
void renderChildBands(BandDesignIntf* parentBand);
void renderGroupHeader(BandDesignIntf* parentBand, IDataSource* dataSource, bool firstTime);
void renderGroupFooter(BandDesignIntf* parentBand);
void initGroups();
void extractGroupsFunction(BandDesignIntf* band);
void extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band);
void extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band);
void extractGroupFunctions(BandDesignIntf* band);
void replaceGroupFunctionsInItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band);
void replaceGroupFunctionsInContainer(BaseDesignIntf* baseItem, BandDesignIntf* band);
void replaceGroupsFunction(BandDesignIntf* band);
void popPageFooterGroupValues(BandDesignIntf* dataBand);
@ -184,6 +186,7 @@ private:
QVector<BandDesignIntf*> m_columnedBandItems;
unsigned long long m_curentNameIndex;
};
} // namespace LimeReport
#endif // LRREPORTRENDER_H