From ed28faf784d6732043a3f8f8ba2c233fce967341 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 1 Mar 2019 17:32:48 +0300 Subject: [PATCH] Default band's background filling mode changed to transparent --- limereport/lrbanddesignintf.cpp | 6 ++++-- limereport/lrbasedesignintf.cpp | 15 +++++++++++++-- limereport/lrbasedesignintf.h | 4 ++++ limereport/lrpagedesignintf.cpp | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index f4a0038..9e3323a 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -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); diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index efebfd8..5426419 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -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(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; diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index b3f5b35..6209b97 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -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); diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index b8a164c..0e039d8 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -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; }