mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
#286 Alternate colors issue has been fixed
This commit is contained in:
parent
d1c97a123a
commit
1fb652e134
@ -133,7 +133,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
||||
|
||||
LIMEREPORT_VERSION_MAJOR = 1
|
||||
LIMEREPORT_VERSION_MINOR = 5
|
||||
LIMEREPORT_VERSION_RELEASE = 64
|
||||
LIMEREPORT_VERSION_RELEASE = 65
|
||||
|
||||
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
||||
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
||||
|
@ -249,6 +249,12 @@ bool BandDesignIntf::isNeedUpdateSize(RenderPass pass) const{
|
||||
return false;
|
||||
}
|
||||
|
||||
void BandDesignIntf::copyBandAttributes(BandDesignIntf *source)
|
||||
{
|
||||
this->copyBookmarks(source);
|
||||
this->setBackgroundColor(source->backgroundColor());
|
||||
}
|
||||
|
||||
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
prepareRect(painter, option, widget);
|
||||
|
@ -272,7 +272,7 @@ public:
|
||||
int shiftItems() const;
|
||||
void setShiftItems(int shiftItems);
|
||||
bool isNeedUpdateSize(RenderPass) const;
|
||||
|
||||
void copyBandAttributes(BandDesignIntf* source);
|
||||
signals:
|
||||
void bandRendered(BandDesignIntf* band);
|
||||
void bandReRendered(BandDesignIntf* oldBand, BandDesignIntf* newBand);
|
||||
|
@ -466,6 +466,15 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
|
||||
replaceGroupFunctionsInContainer(band, band);
|
||||
}
|
||||
|
||||
QColor ReportRender::makeBackgroundColor(BandDesignIntf* band){
|
||||
if (band->useAlternateBackgroundColor()){
|
||||
return datasources()->variable(QLatin1String("line_") + band->objectName().toLower()).toInt() %2 == 0 ?
|
||||
band->backgroundColor() :
|
||||
band->alternateBackgroundColor();
|
||||
}
|
||||
return band->backgroundColor();
|
||||
}
|
||||
|
||||
BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesignIntf* bandData, ReportRender::DataRenderMode mode, bool isLast)
|
||||
{
|
||||
QCoreApplication::processEvents();
|
||||
@ -493,15 +502,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
|
||||
if (patternBand->isFooter())
|
||||
m_lastRenderedFooter = patternBand;
|
||||
|
||||
if (bandClone->useAlternateBackgroundColor()){
|
||||
bandClone->setBackgroundColor(
|
||||
(datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt() %2 == 0 ?
|
||||
bandClone->backgroundColor() :
|
||||
bandClone->alternateBackgroundColor()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
bandClone->setBackgroundColor(makeBackgroundColor(patternBand));
|
||||
patternBand->emitBandRendered(bandClone);
|
||||
m_scriptEngineContext->setCurrentBand(bandClone);
|
||||
emit(patternBand->afterRender());
|
||||
@ -549,7 +550,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
|
||||
startNewPage();
|
||||
if (!bandIsSliced){
|
||||
BandDesignIntf* t = renderData(patternBand);
|
||||
t->copyBookmarks(bandClone);
|
||||
t->copyBandAttributes(bandClone);
|
||||
patternBand->emitBandReRendered(bandClone, t);
|
||||
delete bandClone;
|
||||
bandClone = t;
|
||||
|
@ -173,8 +173,6 @@ private:
|
||||
void startNewColumn();
|
||||
void startNewPage(bool isFirst = false);
|
||||
void resetPageNumber(ResetPageNuberType resetType);
|
||||
//int findLastPageNumber(int currentPage);
|
||||
//int findPageNumber(int currentPage);
|
||||
void savePage(bool isLast = false);
|
||||
QString toString();
|
||||
void initColumns();
|
||||
@ -187,8 +185,8 @@ private:
|
||||
void renameChildItems(BaseDesignIntf *item);
|
||||
void renderGroupFooterByHeader(BandDesignIntf *groupHeader);
|
||||
void updateTOC(BaseDesignIntf* item, int pageNumber);
|
||||
//PagesRange& currentRange(bool isTOC = false){ return (isTOC) ? m_ranges.first(): m_ranges.last();}
|
||||
void placeBandOnPage(BandDesignIntf *band, int columnIndex);
|
||||
QColor makeBackgroundColor(BandDesignIntf *band);
|
||||
private:
|
||||
DataSourceManager* m_datasources;
|
||||
ScriptEngineContext* m_scriptEngineContext;
|
||||
@ -223,7 +221,6 @@ private:
|
||||
bool m_newPageStarted;
|
||||
bool m_lostHeadersMoved;
|
||||
|
||||
|
||||
};
|
||||
} // namespace LimeReport
|
||||
#endif // LRREPORTRENDER_H
|
||||
|
Loading…
Reference in New Issue
Block a user