Group bands rendering has been fixed

This commit is contained in:
Arin Alexander 2021-09-16 02:48:07 +03:00
parent 3569b63e24
commit 9b46cbce78
5 changed files with 46 additions and 38 deletions

View File

@ -141,7 +141,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 5 LIMEREPORT_VERSION_MINOR = 5
LIMEREPORT_VERSION_RELEASE = 88 LIMEREPORT_VERSION_RELEASE = 90
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -643,18 +643,18 @@ void BandDesignIntf::processPopUpAction(QAction *action)
ItemsContainerDesignInft::processPopUpAction(action); ItemsContainerDesignInft::processPopUpAction(action);
} }
void BandDesignIntf::recalcItems(DataSourceManager* dataManager) //void BandDesignIntf::recalcItems(DataSourceManager* dataManager)
{ //{
foreach(BaseDesignIntf* bi, childBaseItems()){ // foreach(BaseDesignIntf* bi, childBaseItems()){
ContentItemDesignIntf* ci = dynamic_cast<ContentItemDesignIntf*>(bi); // ContentItemDesignIntf* ci = dynamic_cast<ContentItemDesignIntf*>(bi);
if (bi){ // if (bi){
ContentItemDesignIntf* pci = dynamic_cast<ContentItemDesignIntf*>(bi->patternItem()); // ContentItemDesignIntf* pci = dynamic_cast<ContentItemDesignIntf*>(bi->patternItem());
ci->setContent(pci->content()); // ci->setContent(pci->content());
} // }
} // }
updateItemSize(dataManager,FirstPass,height()); // updateItemSize(dataManager,FirstPass,height());
} //}
BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent)
{ {
@ -1159,17 +1159,6 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight); BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight);
} }
void BandDesignIntf::restoreItems()
{
foreach(BaseDesignIntf* bi, childBaseItems()){
ContentItemDesignIntf* ci = dynamic_cast<ContentItemDesignIntf*>(bi);
if (ci){
ContentItemDesignIntf* pci = dynamic_cast<ContentItemDesignIntf*>(bi->patternItem());
ci->setContent(pci->content());
}
}
}
void BandDesignIntf::updateBandNameLabel() void BandDesignIntf::updateBandNameLabel()
{ {
if (m_bandNameLabel) m_bandNameLabel->updateLabel(bandTitle()); if (m_bandNameLabel) m_bandNameLabel->updateLabel(bandTitle());

View File

@ -156,8 +156,7 @@ public:
virtual bool isUnique() const; virtual bool isUnique() const;
void setItemMode(BaseDesignIntf::ItemMode mode); void setItemMode(BaseDesignIntf::ItemMode mode);
void updateItemSize(DataSourceManager *dataManager, RenderPass pass=FirstPass, int maxHeight=0); void updateItemSize(DataSourceManager *dataManager, RenderPass pass=FirstPass, int maxHeight=0);
void restoreItems(); // void recalcItems(DataSourceManager* dataManager);
void recalcItems(DataSourceManager* dataManager);
void updateBandNameLabel(); void updateBandNameLabel();
virtual QColor selectionColor() const; virtual QColor selectionColor() const;

View File

@ -359,20 +359,30 @@ void ReportRender::clearPageMap()
m_renderedPages.clear(); m_renderedPages.clear();
} }
bool ReportRender::containsGroupFunctions(BandDesignIntf *band){
foreach(BaseDesignIntf* item,band->childBaseItems()){ bool checkContentItem(ContentItemDesignIntf* item, DataSourceManager* datasources){
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item); QString content = item->content();
if (contentItem){ foreach(QString functionName, datasources->groupFunctionNames()){
QString content = contentItem->content();
foreach(QString functionName, m_datasources->groupFunctionNames()){
#if QT_VERSION < 0x060000 #if QT_VERSION < 0x060000
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){
return true; return true;
} }
#else #else
// TODO: Qt6 port // TODO: Qt6 port
#endif #endif
}
return false;
}
bool ReportRender::containsGroupFunctions(BaseDesignIntf *container){
if (container){
foreach (BaseDesignIntf* item, container->childBaseItems()) {
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
if (contentItem){
if (checkContentItem(contentItem, m_datasources)) return true;
} else {
if (containsGroupFunctions(item)) return true;
} }
} }
} }
@ -846,11 +856,21 @@ BandDesignIntf* ReportRender::findRecalcableBand(BandDesignIntf* patternBand){
return 0; return 0;
} }
void restoreItemsWithGroupFunctions(BaseDesignIntf* container, DataSourceManager* datasources){
foreach(BaseDesignIntf* bi, container->childBaseItems()){
ContentItemDesignIntf* pci = dynamic_cast<ContentItemDesignIntf*>(bi->patternItem());
if (pci && checkContentItem(pci, datasources)){
ContentItemDesignIntf* ci = dynamic_cast<ContentItemDesignIntf*>(bi);
ci->setContent(pci->content());
} else restoreItemsWithGroupFunctions(bi, datasources);
}
}
void ReportRender::recalcIfNeeded(BandDesignIntf* band){ void ReportRender::recalcIfNeeded(BandDesignIntf* band){
BandDesignIntf* recalcBand = findRecalcableBand(band); BandDesignIntf* recalcBand = findRecalcableBand(band);
if (recalcBand){ if (recalcBand){
QString bandName = recalcBand->objectName(); QString bandName = recalcBand->objectName();
recalcBand->restoreItems(); restoreItemsWithGroupFunctions(recalcBand, m_datasources);
recalcBand->setObjectName(recalcBand->patternItem()->objectName()); recalcBand->setObjectName(recalcBand->patternItem()->objectName());
replaceGroupsFunction(recalcBand); replaceGroupsFunction(recalcBand);
recalcBand->updateItemSize(datasources()); recalcBand->updateItemSize(datasources());

View File

@ -139,7 +139,7 @@ private:
qreal calcPageFooterHeight(PageItemDesignIntf* patternPage); qreal calcPageFooterHeight(PageItemDesignIntf* patternPage);
qreal calcSlicePercent(qreal height); qreal calcSlicePercent(qreal height);
bool containsGroupFunctions(BandDesignIntf* band); bool containsGroupFunctions(BaseDesignIntf *container);
void extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band); void extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band);
void extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band); void extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band);
void extractGroupFunctions(BandDesignIntf* band); void extractGroupFunctions(BandDesignIntf* band);