diff --git a/limereport/items/lrabstractlayout.cpp b/limereport/items/lrabstractlayout.cpp index 02b8ca8..47283b7 100644 --- a/limereport/items/lrabstractlayout.cpp +++ b/limereport/items/lrabstractlayout.cpp @@ -116,22 +116,32 @@ bool AbstractLayout::isEmpty() const return (isEmpty && allItemsIsText); } -void AbstractLayout::paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget) +void AbstractLayout::paintChild(BaseDesignIntf *child, QPointF parentPos, QPainter *painter) { - if (isSelected()){ - foreach( BaseDesignIntf* item, m_children){ - ppainter->save(); - ppainter->setPen(Qt::red); - ppainter->drawRect( - QRectF(item->pos().x(),item->pos().y(), - item->rect().bottomRight().rx(), - item->rect().bottomRight().ry() - ) - ); - ppainter->restore(); + if (!child->childBaseItems().isEmpty()){ + foreach (BaseDesignIntf* item, child->childBaseItems()) { + paintChild(item, child->pos(),painter); } } - LayoutDesignIntf::paint(ppainter, option, widget); + painter->drawRect( + QRectF(parentPos.x()+child->pos().x(), parentPos.y()+child->pos().y(), + child->rect().bottomRight().rx(), + child->rect().bottomRight().ry() + ) + ); +} + +void AbstractLayout::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) +{ + if (isSelected()){ + painter->save(); + painter->setPen(Qt::red); + foreach( BaseDesignIntf* item, m_children){ + paintChild(item, QPointF(0,0), painter); + } + painter->restore(); + } + LayoutDesignIntf::paint(painter, option, widget); } int AbstractLayout::childrenCount() diff --git a/limereport/items/lrabstractlayout.h b/limereport/items/lrabstractlayout.h index 52deaed..6f5e796 100644 --- a/limereport/items/lrabstractlayout.h +++ b/limereport/items/lrabstractlayout.h @@ -24,7 +24,8 @@ public: void addChild(BaseDesignIntf *item,bool updateSize=true); void restoreChild(BaseDesignIntf *item); bool isEmpty() const; - void paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget); + void paintChild(BaseDesignIntf* child, QPointF parentPos, QPainter* painter); + void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget); bool hideEmptyItems() const; void setHideEmptyItems(bool hideEmptyItems); diff --git a/limereport/lrpagedesignintf.cpp b/limereport/lrpagedesignintf.cpp index d712528..6581029 100644 --- a/limereport/lrpagedesignintf.cpp +++ b/limereport/lrpagedesignintf.cpp @@ -2200,6 +2200,7 @@ void InsertHLayoutCommand::undoIt() bi->setPos(m_elements.value(bi->objectName())); bi->setFixedPos(false); bi->setPossibleResizeDirectionFlags(BaseDesignIntf::AllDirections); + bi->setVisible(true); } } page()->removeReportItem(layout,false); @@ -2384,6 +2385,7 @@ void InsertVLayoutCommand::undoIt() bi->setPos(m_elements.value(bi->objectName())); bi->setFixedPos(false); bi->setPossibleResizeDirectionFlags(BaseDesignIntf::AllDirections); + bi->setVisible(true); } } page()->removeReportItem(layout,false);