mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 00:33:02 +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_MAJOR = 1
|
||||||
LIMEREPORT_VERSION_MINOR = 5
|
LIMEREPORT_VERSION_MINOR = 5
|
||||||
LIMEREPORT_VERSION_RELEASE = 64
|
LIMEREPORT_VERSION_RELEASE = 65
|
||||||
|
|
||||||
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}\\\"
|
||||||
|
@ -249,6 +249,12 @@ bool BandDesignIntf::isNeedUpdateSize(RenderPass pass) const{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BandDesignIntf::copyBandAttributes(BandDesignIntf *source)
|
||||||
|
{
|
||||||
|
this->copyBookmarks(source);
|
||||||
|
this->setBackgroundColor(source->backgroundColor());
|
||||||
|
}
|
||||||
|
|
||||||
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
prepareRect(painter, option, widget);
|
prepareRect(painter, option, widget);
|
||||||
|
@ -272,7 +272,7 @@ public:
|
|||||||
int shiftItems() const;
|
int shiftItems() const;
|
||||||
void setShiftItems(int shiftItems);
|
void setShiftItems(int shiftItems);
|
||||||
bool isNeedUpdateSize(RenderPass) const;
|
bool isNeedUpdateSize(RenderPass) const;
|
||||||
|
void copyBandAttributes(BandDesignIntf* source);
|
||||||
signals:
|
signals:
|
||||||
void bandRendered(BandDesignIntf* band);
|
void bandRendered(BandDesignIntf* band);
|
||||||
void bandReRendered(BandDesignIntf* oldBand, BandDesignIntf* newBand);
|
void bandReRendered(BandDesignIntf* oldBand, BandDesignIntf* newBand);
|
||||||
|
@ -466,6 +466,15 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
|
|||||||
replaceGroupFunctionsInContainer(band, 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)
|
BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesignIntf* bandData, ReportRender::DataRenderMode mode, bool isLast)
|
||||||
{
|
{
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
@ -493,15 +502,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
|
|||||||
if (patternBand->isFooter())
|
if (patternBand->isFooter())
|
||||||
m_lastRenderedFooter = patternBand;
|
m_lastRenderedFooter = patternBand;
|
||||||
|
|
||||||
if (bandClone->useAlternateBackgroundColor()){
|
bandClone->setBackgroundColor(makeBackgroundColor(patternBand));
|
||||||
bandClone->setBackgroundColor(
|
|
||||||
(datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt() %2 == 0 ?
|
|
||||||
bandClone->backgroundColor() :
|
|
||||||
bandClone->alternateBackgroundColor()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
patternBand->emitBandRendered(bandClone);
|
patternBand->emitBandRendered(bandClone);
|
||||||
m_scriptEngineContext->setCurrentBand(bandClone);
|
m_scriptEngineContext->setCurrentBand(bandClone);
|
||||||
emit(patternBand->afterRender());
|
emit(patternBand->afterRender());
|
||||||
@ -549,7 +550,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
|
|||||||
startNewPage();
|
startNewPage();
|
||||||
if (!bandIsSliced){
|
if (!bandIsSliced){
|
||||||
BandDesignIntf* t = renderData(patternBand);
|
BandDesignIntf* t = renderData(patternBand);
|
||||||
t->copyBookmarks(bandClone);
|
t->copyBandAttributes(bandClone);
|
||||||
patternBand->emitBandReRendered(bandClone, t);
|
patternBand->emitBandReRendered(bandClone, t);
|
||||||
delete bandClone;
|
delete bandClone;
|
||||||
bandClone = t;
|
bandClone = t;
|
||||||
|
@ -173,8 +173,6 @@ private:
|
|||||||
void startNewColumn();
|
void startNewColumn();
|
||||||
void startNewPage(bool isFirst = false);
|
void startNewPage(bool isFirst = false);
|
||||||
void resetPageNumber(ResetPageNuberType resetType);
|
void resetPageNumber(ResetPageNuberType resetType);
|
||||||
//int findLastPageNumber(int currentPage);
|
|
||||||
//int findPageNumber(int currentPage);
|
|
||||||
void savePage(bool isLast = false);
|
void savePage(bool isLast = false);
|
||||||
QString toString();
|
QString toString();
|
||||||
void initColumns();
|
void initColumns();
|
||||||
@ -187,8 +185,8 @@ private:
|
|||||||
void renameChildItems(BaseDesignIntf *item);
|
void renameChildItems(BaseDesignIntf *item);
|
||||||
void renderGroupFooterByHeader(BandDesignIntf *groupHeader);
|
void renderGroupFooterByHeader(BandDesignIntf *groupHeader);
|
||||||
void updateTOC(BaseDesignIntf* item, int pageNumber);
|
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);
|
void placeBandOnPage(BandDesignIntf *band, int columnIndex);
|
||||||
|
QColor makeBackgroundColor(BandDesignIntf *band);
|
||||||
private:
|
private:
|
||||||
DataSourceManager* m_datasources;
|
DataSourceManager* m_datasources;
|
||||||
ScriptEngineContext* m_scriptEngineContext;
|
ScriptEngineContext* m_scriptEngineContext;
|
||||||
@ -223,7 +221,6 @@ private:
|
|||||||
bool m_newPageStarted;
|
bool m_newPageStarted;
|
||||||
bool m_lostHeadersMoved;
|
bool m_lostHeadersMoved;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace LimeReport
|
} // namespace LimeReport
|
||||||
#endif // LRREPORTRENDER_H
|
#endif // LRREPORTRENDER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user