mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
alternateBackgrounColor property has been added
This commit is contained in:
parent
dd40aa1137
commit
8ed24f9f75
@ -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;
|
||||
|
@ -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;}
|
||||
|
@ -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()
|
||||
@ -738,6 +739,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;
|
||||
|
@ -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{
|
||||
|
@ -333,6 +333,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() ){
|
||||
|
Loading…
Reference in New Issue
Block a user