mirror of
https://github.com/fralx/LimeReport.git
synced 2025-03-13 22:03:47 +03:00
useAlternateBackgroundColor property has been added
This commit is contained in:
parent
4c6c0dfd3b
commit
242dbe75d2
@ -79,6 +79,23 @@ bool DataBand::isUnique() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataBand::preparePopUpMenu(QMenu &menu)
|
||||||
|
{
|
||||||
|
DataBandDesignIntf::preparePopUpMenu(menu);
|
||||||
|
|
||||||
|
QAction* autoSplittableAction = menu.addAction(tr("useAlternateBackgroundColor"));
|
||||||
|
autoSplittableAction->setCheckable(true);
|
||||||
|
autoSplittableAction->setChecked(useAlternateBackgroundColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataBand::processPopUpAction(QAction *action)
|
||||||
|
{
|
||||||
|
DataBandDesignIntf::processPopUpAction(action);
|
||||||
|
if (action->text().compare(tr("useAlternateBackgroundColor")) == 0){
|
||||||
|
setProperty("useAlternateBackgroundColor",action->isChecked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QColor DataBand::bandColor() const
|
QColor DataBand::bandColor() const
|
||||||
{
|
{
|
||||||
return QColor(Qt::darkGreen);
|
return QColor(Qt::darkGreen);
|
||||||
|
@ -48,10 +48,13 @@ class DataBand : public DataBandDesignIntf
|
|||||||
Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage)
|
Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage)
|
||||||
Q_PROPERTY(bool startFromNewPage READ startFromNewPage WRITE setStartFromNewPage)
|
Q_PROPERTY(bool startFromNewPage READ startFromNewPage WRITE setStartFromNewPage)
|
||||||
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
|
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
|
||||||
|
Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor)
|
||||||
public:
|
public:
|
||||||
DataBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
DataBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||||
bool isUnique() const;
|
bool isUnique() const;
|
||||||
bool isData() const {return true;}
|
bool isData() const {return true;}
|
||||||
|
void preparePopUpMenu(QMenu &menu);
|
||||||
|
void processPopUpAction(QAction *action);
|
||||||
protected:
|
protected:
|
||||||
QColor bandColor() const;
|
QColor bandColor() const;
|
||||||
private:
|
private:
|
||||||
@ -82,7 +85,7 @@ class DataFooterBand : public BandDesignIntf
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
|
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
|
||||||
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
|
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
|
||||||
Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways())
|
Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways)
|
||||||
public:
|
public:
|
||||||
DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0);
|
DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0);
|
||||||
bool isUnique() const {return false;}
|
bool isUnique() const {return false;}
|
||||||
|
@ -43,6 +43,7 @@ class SubDetailBand : public DataBandDesignIntf
|
|||||||
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
|
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
|
||||||
Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether)
|
Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether)
|
||||||
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
|
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
|
||||||
|
Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor)
|
||||||
public:
|
public:
|
||||||
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||||
bool isUnique() const {return false;}
|
bool isUnique() const {return false;}
|
||||||
|
@ -147,7 +147,8 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
|
|||||||
m_startNewPage(false),
|
m_startNewPage(false),
|
||||||
m_startFromNewPage(false),
|
m_startFromNewPage(false),
|
||||||
m_printAlways(false),
|
m_printAlways(false),
|
||||||
m_repeatOnEachRow(false)
|
m_repeatOnEachRow(false),
|
||||||
|
m_useAlternateBackgroundColor(false)
|
||||||
{
|
{
|
||||||
setPossibleResizeDirectionFlags(ResizeBottom);
|
setPossibleResizeDirectionFlags(ResizeBottom);
|
||||||
setPossibleMoveFlags(TopBotom);
|
setPossibleMoveFlags(TopBotom);
|
||||||
@ -447,7 +448,7 @@ void BandDesignIntf::preparePopUpMenu(QMenu &menu)
|
|||||||
|
|
||||||
QAction* autoSplittableAction = menu.addAction(tr("Splittable"));
|
QAction* autoSplittableAction = menu.addAction(tr("Splittable"));
|
||||||
autoSplittableAction->setCheckable(true);
|
autoSplittableAction->setCheckable(true);
|
||||||
autoSplittableAction->setChecked(isSplittable());
|
autoSplittableAction->setChecked(isSplittable());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BandDesignIntf::processPopUpAction(QAction *action)
|
void BandDesignIntf::processPopUpAction(QAction *action)
|
||||||
@ -780,6 +781,21 @@ void BandDesignIntf::childBandDeleted(QObject *band)
|
|||||||
m_childBands.removeAt(m_childBands.indexOf(reinterpret_cast<BandDesignIntf*>(band)));
|
m_childBands.removeAt(m_childBands.indexOf(reinterpret_cast<BandDesignIntf*>(band)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BandDesignIntf::useAlternateBackgroundColor() const
|
||||||
|
{
|
||||||
|
return m_useAlternateBackgroundColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BandDesignIntf::setUseAlternateBackgroundColor(bool useAlternateBackgroundColor)
|
||||||
|
{
|
||||||
|
if (m_useAlternateBackgroundColor != useAlternateBackgroundColor){
|
||||||
|
QColor oldValue = m_useAlternateBackgroundColor;
|
||||||
|
m_useAlternateBackgroundColor=useAlternateBackgroundColor;
|
||||||
|
if (!isLoading())
|
||||||
|
notify("useAlternateBackgroundColor",oldValue,useAlternateBackgroundColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QColor BandDesignIntf::alternateBackgroundColor() const
|
QColor BandDesignIntf::alternateBackgroundColor() const
|
||||||
{
|
{
|
||||||
if (metaObject()->indexOfProperty("alternateBackgroundColor")!=-1)
|
if (metaObject()->indexOfProperty("alternateBackgroundColor")!=-1)
|
||||||
@ -790,7 +806,12 @@ QColor BandDesignIntf::alternateBackgroundColor() const
|
|||||||
|
|
||||||
void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgroundColor)
|
void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgroundColor)
|
||||||
{
|
{
|
||||||
m_alternateBackgroundColor = alternateBackgroundColor;
|
if (m_alternateBackgroundColor != alternateBackgroundColor){
|
||||||
|
QColor oldValue = m_alternateBackgroundColor;
|
||||||
|
m_alternateBackgroundColor=alternateBackgroundColor;
|
||||||
|
if (!isLoading())
|
||||||
|
notify("alternateBackgroundColor",oldValue,alternateBackgroundColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BandDesignIntf::repeatOnEachRow() const
|
bool BandDesignIntf::repeatOnEachRow() const
|
||||||
|
@ -219,6 +219,8 @@ public:
|
|||||||
void setRepeatOnEachRow(bool repeatOnEachRow);
|
void setRepeatOnEachRow(bool repeatOnEachRow);
|
||||||
QColor alternateBackgroundColor() const;
|
QColor alternateBackgroundColor() const;
|
||||||
void setAlternateBackgroundColor(const QColor &alternateBackgroundColor);
|
void setAlternateBackgroundColor(const QColor &alternateBackgroundColor);
|
||||||
|
bool useAlternateBackgroundColor() const;
|
||||||
|
void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void bandRendered(BandDesignIntf* band);
|
void bandRendered(BandDesignIntf* band);
|
||||||
@ -276,7 +278,8 @@ private:
|
|||||||
bool m_printAlways;
|
bool m_printAlways;
|
||||||
bool m_repeatOnEachRow;
|
bool m_repeatOnEachRow;
|
||||||
QMap<QString,BaseDesignIntf*> m_slicedItems;
|
QMap<QString,BaseDesignIntf*> m_slicedItems;
|
||||||
QColor m_alternateBackgroundColor;
|
QColor m_alternateBackgroundColor;
|
||||||
|
bool m_useAlternateBackgroundColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DataBandDesignIntf : public BandDesignIntf{
|
class DataBandDesignIntf : public BandDesignIntf{
|
||||||
|
@ -431,13 +431,14 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign
|
|||||||
if (patternBand->isFooter())
|
if (patternBand->isFooter())
|
||||||
m_lastRenderedFooter = patternBand;
|
m_lastRenderedFooter = patternBand;
|
||||||
|
|
||||||
|
if (bandClone->useAlternateBackgroundColor()){
|
||||||
bandClone->setBackgroundColor(
|
bandClone->setBackgroundColor(
|
||||||
(datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt() %2 !=0 ?
|
(datasources()->variable(QLatin1String("line_")+patternBand->objectName().toLower()).toInt() %2 == 0 ?
|
||||||
bandClone->backgroundColor():
|
bandClone->backgroundColor() :
|
||||||
bandClone->alternateBackgroundColor()
|
bandClone->alternateBackgroundColor()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
patternBand->emitBandRendered(bandClone);
|
patternBand->emitBandRendered(bandClone);
|
||||||
emit(patternBand->afterRender());
|
emit(patternBand->afterRender());
|
||||||
|
Loading…
Reference in New Issue
Block a user