0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00

Merge branch 'master' into 1.4

This commit is contained in:
Arin Alexander 2016-10-18 13:58:49 +03:00
commit 856a3e6bee
5 changed files with 23 additions and 0 deletions

View File

@ -47,6 +47,7 @@ class DataBand : public DataBandDesignIntf
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage)
Q_PROPERTY(bool startFromNewPage READ startFromNewPage WRITE setStartFromNewPage)
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
public:
DataBand(QObject* owner = 0, QGraphicsItem* parent=0);
bool isUnique() const;

View File

@ -42,6 +42,7 @@ class SubDetailBand : public DataBandDesignIntf
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether)
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
public:
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
bool isUnique() const {return false;}

View File

@ -168,6 +168,7 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
m_bandNameLabel = new BandNameLabel(this);
m_bandNameLabel->setVisible(false);
if (scene()) scene()->addItem(m_bandNameLabel);
m_alternateBackgroundColor = backgroundColor();
}
BandDesignIntf::~BandDesignIntf()
@ -745,6 +746,16 @@ void BandDesignIntf::childBandDeleted(QObject *band)
m_childBands.removeAt(m_childBands.indexOf(reinterpret_cast<BandDesignIntf*>(band)));
}
QColor BandDesignIntf::alternateBackgroundColor() const
{
return m_alternateBackgroundColor;
}
void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgroundColor)
{
m_alternateBackgroundColor = alternateBackgroundColor;
}
bool BandDesignIntf::repeatOnEachRow() const
{
return m_repeatOnEachRow;

View File

@ -216,6 +216,9 @@ public:
void setPrintAlways(bool printAlways);
bool repeatOnEachRow() const;
void setRepeatOnEachRow(bool repeatOnEachRow);
QColor alternateBackgroundColor() const;
void setAlternateBackgroundColor(const QColor &alternateBackgroundColor);
signals:
void bandRendered(BandDesignIntf* band);
protected:
@ -270,6 +273,7 @@ private:
bool m_printAlways;
bool m_repeatOnEachRow;
QMap<QString,BaseDesignIntf*> m_slicedItems;
QColor m_alternateBackgroundColor;
};
class DataBandDesignIntf : public BandDesignIntf{

View File

@ -376,6 +376,12 @@ void ReportRender::renderBand(BandDesignIntf *patternBand, ReportRender::DataRen
m_lastRenderedFooter = patternBand;
BandDesignIntf* bandClone=renderData(patternBand);
bandClone->setBackgroundColor(
(datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt()%2!=0 ?
patternBand->backgroundColor():
patternBand->alternateBackgroundColor()
)
);
patternBand->emitBandRendered(bandClone);
if ( isLast && bandClone->keepFooterTogether() && bandClone->sliceLastRow() ){