mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 16:44:39 +03:00
Layout painting has been refactored
This commit is contained in:
parent
10015ed783
commit
7bc3a7e1cd
@ -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()
|
||||
if (!child->childBaseItems().isEmpty()){
|
||||
foreach (BaseDesignIntf* item, child->childBaseItems()) {
|
||||
paintChild(item, child->pos(),painter);
|
||||
}
|
||||
}
|
||||
painter->drawRect(
|
||||
QRectF(parentPos.x()+child->pos().x(), parentPos.y()+child->pos().y(),
|
||||
child->rect().bottomRight().rx(),
|
||||
child->rect().bottomRight().ry()
|
||||
)
|
||||
);
|
||||
ppainter->restore();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
LayoutDesignIntf::paint(ppainter, option, widget);
|
||||
painter->restore();
|
||||
}
|
||||
LayoutDesignIntf::paint(painter, option, widget);
|
||||
}
|
||||
|
||||
int AbstractLayout::childrenCount()
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user