mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 00:33:02 +03:00
Group functions have been fixed
This commit is contained in:
parent
f3e633e469
commit
d3c9661579
@ -258,15 +258,19 @@ void ReportRender::extractGroupsFunction(BandDesignIntf *band)
|
|||||||
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
|
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
|
||||||
QRegExp rxName(QString(Const::GROUP_FUNCTION_NAME_RX).arg(functionName));
|
QRegExp rxName(QString(Const::GROUP_FUNCTION_NAME_RX).arg(functionName));
|
||||||
if (rx.indexIn(contentItem->content())>=0){
|
if (rx.indexIn(contentItem->content())>=0){
|
||||||
BandDesignIntf* dataBand = m_patternPageItem->bandByName(rx.cap(Const::DATASOURCE_INDEX));
|
int pos = 0;
|
||||||
if (dataBand){
|
while ( (pos = rx.indexIn(contentItem->content(),pos)) != -1){
|
||||||
GroupFunction* gf = datasources()->addGroupFunction(functionName,rx.cap(Const::VALUE_INDEX),band->objectName(),dataBand->objectName());
|
BandDesignIntf* dataBand = m_patternPageItem->bandByName(rx.cap(Const::DATASOURCE_INDEX));
|
||||||
if (gf){
|
if (dataBand){
|
||||||
connect(dataBand,SIGNAL(bandRendered(BandDesignIntf*)),gf,SLOT(slotBandRendered(BandDesignIntf*)));
|
GroupFunction* gf = datasources()->addGroupFunction(functionName,rx.cap(Const::VALUE_INDEX),band->objectName(),dataBand->objectName());
|
||||||
|
if (gf){
|
||||||
|
connect(dataBand,SIGNAL(bandRendered(BandDesignIntf*)),gf,SLOT(slotBandRendered(BandDesignIntf*)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GroupFunction* gf = datasources()->addGroupFunction(functionName,rx.cap(Const::VALUE_INDEX),band->objectName(),rx.cap(Const::DATASOURCE_INDEX));
|
||||||
|
gf->setInvalid(tr("Databand \"%1\" not found").arg(rx.cap(Const::DATASOURCE_INDEX)));
|
||||||
}
|
}
|
||||||
} else {
|
pos += rx.matchedLength();
|
||||||
GroupFunction* gf = datasources()->addGroupFunction(functionName,rx.cap(Const::VALUE_INDEX),band->objectName(),rx.cap(Const::DATASOURCE_INDEX));
|
|
||||||
gf->setInvalid(tr("Databand \"%1\" not found").arg(rx.cap(Const::DATASOURCE_INDEX)));
|
|
||||||
}
|
}
|
||||||
} else if (rxName.indexIn(contentItem->content())>=0){
|
} else if (rxName.indexIn(contentItem->content())>=0){
|
||||||
GroupFunction* gf = datasources()->addGroupFunction(functionName,rxName.cap(1),band->objectName(),"");
|
GroupFunction* gf = datasources()->addGroupFunction(functionName,rxName.cap(1),band->objectName(),"");
|
||||||
@ -286,7 +290,11 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
|
|||||||
foreach(QString functionName, m_datasources->groupFunctionNames()){
|
foreach(QString functionName, m_datasources->groupFunctionNames()){
|
||||||
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
|
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
|
||||||
if (rx.indexIn(content)>=0){
|
if (rx.indexIn(content)>=0){
|
||||||
content.replace(rx,QString("%1(%2,%3)").arg(functionName).arg('"'+rx.cap(4)+'"').arg('"'+band->objectName()+'"'));
|
int pos = 0;
|
||||||
|
while ( (pos = rx.indexIn(content,pos))!= -1 ){
|
||||||
|
content.replace(rx.capturedTexts().at(0),QString("%1(%2,%3)").arg(functionName).arg('"'+rx.cap(4)+'"').arg('"'+band->objectName()+'"'));
|
||||||
|
pos += rx.matchedLength();
|
||||||
|
}
|
||||||
contentItem->setContent(content);
|
contentItem->setContent(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user