mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-09-23 16:49:07 +03:00
backgroundBrushStyle property has been added
This commit is contained in:
@@ -183,16 +183,20 @@ BandDesignIntf::~BandDesignIntf()
|
||||
delete m_bandNameLabel;
|
||||
}
|
||||
|
||||
void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
if (backgroundColor()!=Qt::white) {
|
||||
ppainter->fillRect(rect(),backgroundColor());
|
||||
|
||||
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){
|
||||
ppainter->save();
|
||||
|
||||
if (itemMode() & DesignMode){
|
||||
painter->save();
|
||||
QString bandText = objectName();
|
||||
if (parentBand()) bandText+=QLatin1String(" connected to ")+parentBand()->objectName();
|
||||
QFont font("Arial",7*Const::fontFACTOR,-1,true);
|
||||
QFont font("Arial", 7 * Const::fontFACTOR, -1, true);
|
||||
QFontMetrics fontMetrics(font);
|
||||
|
||||
QVector<QRectF> bandNameRects;
|
||||
@@ -204,22 +208,22 @@ void BandDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o
|
||||
//if (isSelected()) ppainter->setPen(QColor(167,244,167));
|
||||
// else ppainter->setPen(QColor(220,220,220));
|
||||
|
||||
ppainter->setFont(font);
|
||||
painter->setFont(font);
|
||||
for (int i=0;i<bandNameRects.count();i++){
|
||||
QRectF labelRect = bandNameRects[i].adjusted(-2,-2,2,2);
|
||||
if ((labelRect.height())<height() && (childBaseItems().isEmpty()) && !isSelected()){
|
||||
ppainter->setRenderHint(QPainter::Antialiasing);
|
||||
ppainter->setBrush(bandColor());
|
||||
ppainter->setOpacity(Const::BAND_NAME_AREA_OPACITY);
|
||||
ppainter->drawRoundedRect(labelRect,8,8);
|
||||
ppainter->setOpacity(Const::BAND_NAME_TEXT_OPACITY);
|
||||
ppainter->setPen(Qt::black);
|
||||
ppainter->drawText(bandNameRects[i],Qt::AlignHCenter,bandText);
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
painter->setBrush(bandColor());
|
||||
painter->setOpacity(Const::BAND_NAME_AREA_OPACITY);
|
||||
painter->drawRoundedRect(labelRect,8,8);
|
||||
painter->setOpacity(Const::BAND_NAME_TEXT_OPACITY);
|
||||
painter->setPen(Qt::black);
|
||||
painter->drawText(bandNameRects[i],Qt::AlignHCenter,bandText);
|
||||
}
|
||||
}
|
||||
ppainter->restore();
|
||||
painter->restore();
|
||||
}
|
||||
BaseDesignIntf::paint(ppainter,option,widget);
|
||||
BaseDesignIntf::paint(painter,option,widget);
|
||||
}
|
||||
|
||||
BandDesignIntf::BandsType BandDesignIntf::bandType() const
|
||||
|
Reference in New Issue
Block a user