Default band's background filling mode changed to transparent

This commit is contained in:
Arin Alexander 2019-03-01 17:32:48 +03:00
parent 1bb6fc8f5a
commit ed28faf784
4 changed files with 22 additions and 5 deletions

View File

@ -54,11 +54,11 @@ void BandMarker::paint(QPainter *painter, const QStyleOptionGraphicsItem* /**opt
painter->setOpacity(Const::BAND_MARKER_OPACITY);
painter->fillRect(boundingRect(),m_color);
painter->setOpacity(1);
painter->setPen(QPen(QBrush(Qt::white),2));
painter->setPen(QPen(QBrush(Qt::lightGray),2));
painter->fillRect(QRectF(
boundingRect().bottomLeft().x(),
boundingRect().bottomLeft().y()-4,
boundingRect().width(),4), Qt::white
boundingRect().width(),4), Qt::lightGray
);
painter->setRenderHint(QPainter::Antialiasing);
@ -175,6 +175,8 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
if (parentItem) setWidth(parentItem->width());
}
setBackgroundMode(BGMode::TransparentMode);
setFillTransparentInDesignMode(false);
setHeight(100);
setFixedPos(true);
setFlag(QGraphicsItem::ItemClipsChildrenToShape);

View File

@ -82,7 +82,8 @@ BaseDesignIntf::BaseDesignIntf(const QString &storageTypeName, QObject *owner, Q
m_watermark(false),
m_hovered(false),
m_joinMarkerOn(false),
m_selectionMarker(0)
m_selectionMarker(0),
m_fillTransparentInDesignMode(true)
{
setGeometry(QRectF(0, 0, m_width, m_height));
if (BaseDesignIntf *item = dynamic_cast<BaseDesignIntf *>(parent)) {
@ -430,7 +431,7 @@ void BaseDesignIntf::prepareRect(QPainter *painter, const QStyleOptionGraphicsIt
qreal o = (itemMode() & DesignMode) ? 0.5 : qreal(m_opacity) / 100;
painter->setOpacity(o);
painter->fillRect(r, brush);
} else if (itemMode() & DesignMode){
} else if ((itemMode() & DesignMode) && fillTransparentInDesignMode()){
painter->setOpacity(0.1);
painter->fillRect(r, QBrush(QPixmap(":/report/images/empty")));
}
@ -721,6 +722,16 @@ void BaseDesignIntf::updatePossibleDirectionFlags(){
}
}
bool BaseDesignIntf::fillTransparentInDesignMode() const
{
return m_fillTransparentInDesignMode;
}
void BaseDesignIntf::setFillTransparentInDesignMode(bool fillTransparentInDesignMode)
{
m_fillTransparentInDesignMode = fillTransparentInDesignMode;
}
bool BaseDesignIntf::fillInSecondPass() const
{
return m_fillInSecondPass;

View File

@ -295,6 +295,9 @@ public:
Q_INVOKABLE QString setItemPosX(qreal xValue);
Q_INVOKABLE QString setItemPosY(qreal yValue);
bool fillTransparentInDesignMode() const;
void setFillTransparentInDesignMode(bool fillTransparentInDesignMode);
protected:
//ICollectionContainer
@ -418,6 +421,7 @@ private:
bool m_joinMarkerOn;
SelectionMarker* m_selectionMarker;
Marker* m_joinMarker;
bool m_fillTransparentInDesignMode;
signals:
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
void posChanging(QObject* object, QPointF newPos, QPointF oldPos);

View File

@ -2481,7 +2481,7 @@ CommandIf::Ptr BandMoveFromToCommand::create(PageDesignIntf* page, int from, int
bool BandMoveFromToCommand::doIt()
{
if (page() && from != to) {
if (page() && page()->pageItem() && from != to) {
page()->pageItem()->moveBandFromTo(from, to);
return true;
}