mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54: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);
|
return (isEmpty && allItemsIsText);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractLayout::paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
void AbstractLayout::paintChild(BaseDesignIntf *child, QPointF parentPos, QPainter *painter)
|
||||||
{
|
{
|
||||||
if (isSelected()){
|
if (!child->childBaseItems().isEmpty()){
|
||||||
foreach( BaseDesignIntf* item, m_children){
|
foreach (BaseDesignIntf* item, child->childBaseItems()) {
|
||||||
ppainter->save();
|
paintChild(item, child->pos(),painter);
|
||||||
ppainter->setPen(Qt::red);
|
}
|
||||||
ppainter->drawRect(
|
}
|
||||||
QRectF(item->pos().x(),item->pos().y(),
|
painter->drawRect(
|
||||||
item->rect().bottomRight().rx(),
|
QRectF(parentPos.x()+child->pos().x(), parentPos.y()+child->pos().y(),
|
||||||
item->rect().bottomRight().ry()
|
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()
|
int AbstractLayout::childrenCount()
|
||||||
|
@ -24,7 +24,8 @@ public:
|
|||||||
void addChild(BaseDesignIntf *item,bool updateSize=true);
|
void addChild(BaseDesignIntf *item,bool updateSize=true);
|
||||||
void restoreChild(BaseDesignIntf *item);
|
void restoreChild(BaseDesignIntf *item);
|
||||||
bool isEmpty() const;
|
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;
|
bool hideEmptyItems() const;
|
||||||
void setHideEmptyItems(bool hideEmptyItems);
|
void setHideEmptyItems(bool hideEmptyItems);
|
||||||
|
@ -2200,6 +2200,7 @@ void InsertHLayoutCommand::undoIt()
|
|||||||
bi->setPos(m_elements.value(bi->objectName()));
|
bi->setPos(m_elements.value(bi->objectName()));
|
||||||
bi->setFixedPos(false);
|
bi->setFixedPos(false);
|
||||||
bi->setPossibleResizeDirectionFlags(BaseDesignIntf::AllDirections);
|
bi->setPossibleResizeDirectionFlags(BaseDesignIntf::AllDirections);
|
||||||
|
bi->setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
page()->removeReportItem(layout,false);
|
page()->removeReportItem(layout,false);
|
||||||
@ -2384,6 +2385,7 @@ void InsertVLayoutCommand::undoIt()
|
|||||||
bi->setPos(m_elements.value(bi->objectName()));
|
bi->setPos(m_elements.value(bi->objectName()));
|
||||||
bi->setFixedPos(false);
|
bi->setFixedPos(false);
|
||||||
bi->setPossibleResizeDirectionFlags(BaseDesignIntf::AllDirections);
|
bi->setPossibleResizeDirectionFlags(BaseDesignIntf::AllDirections);
|
||||||
|
bi->setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
page()->removeReportItem(layout,false);
|
page()->removeReportItem(layout,false);
|
||||||
|
Loading…
Reference in New Issue
Block a user