0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-26 01:24:39 +03:00

backgroundMode property added to the band items

This commit is contained in:
Arin Alex 2018-04-19 22:39:17 +03:00
parent 724d947bfe
commit e555590008
2 changed files with 23 additions and 6 deletions

View File

@ -182,14 +182,27 @@ QString BandDesignIntf::translateBandName(const BaseDesignIntf* item) const{
} }
} }
void BandDesignIntf::setBackgroundModeProperty(BaseDesignIntf::BGMode value)
{
if (value!=backgroundMode()){
BaseDesignIntf::BGMode oldValue = backgroundMode();
setBackgroundMode(value);
notify("backgroundMode",oldValue,value);
}
}
void BandDesignIntf::setBackgroundOpacity(int value)
{
if (opacity()!=value){
int oldValue = opacity();
setOpacity(value);
notify("backgroundOpacity",oldValue,value);
}
}
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{ {
prepareRect(painter, option, widget);
if ( !(backgroundColor() == Qt::white && backgroundBrushStyle() == SolidPattern) ) {
QBrush brush(backgroundColor(), static_cast<Qt::BrushStyle>(backgroundBrushStyle()));
brush.setTransform(painter->worldTransform().inverted());
painter->fillRect(rect(), brush);
}
if (itemMode() & DesignMode){ if (itemMode() & DesignMode){
painter->save(); painter->save();

View File

@ -105,6 +105,8 @@ class BandDesignIntf : public ItemsContainerDesignInft
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle) Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
Q_PROPERTY(bool printIfEmpty READ printIfEmpty WRITE setPrintIfEmpty) Q_PROPERTY(bool printIfEmpty READ printIfEmpty WRITE setPrintIfEmpty)
Q_PROPERTY(BGMode backgroundMode READ backgroundMode WRITE setBackgroundModeProperty)
Q_PROPERTY(int backgroundOpacity READ opacity WRITE setBackgroundOpacity)
Q_ENUMS(BandColumnsLayoutType) Q_ENUMS(BandColumnsLayoutType)
friend class BandMarker; friend class BandMarker;
friend class BandNameLabel; friend class BandNameLabel;
@ -235,6 +237,8 @@ public:
QColor alternateBackgroundColor() const; QColor alternateBackgroundColor() const;
void setAlternateBackgroundColor(const QColor &alternateBackgroundColor); void setAlternateBackgroundColor(const QColor &alternateBackgroundColor);
qreal bottomSpace() const; qreal bottomSpace() const;
void setBackgroundModeProperty(BGMode value);
void setBackgroundOpacity(int value);
signals: signals:
void bandRendered(BandDesignIntf* band); void bandRendered(BandDesignIntf* band);
protected: protected: