Layout spacing property has been added to layouts

This commit is contained in:
Arin Alexander
2019-02-05 23:25:18 +03:00
parent 65a3a36770
commit 867448d0fd
5 changed files with 44 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ namespace LimeReport {
AbstractLayout::AbstractLayout(QString xmlTag, QObject* owner, QGraphicsItem* parent)
: LayoutDesignIntf(xmlTag, owner, parent), m_isRelocating(false), m_layoutType(Layout),
m_hideEmptyItems(false)
m_hideEmptyItems(false), m_layoutSpacing(0)
{
setPossibleResizeDirectionFlags(AllDirections);
m_layoutMarker = new LayoutMarker(this);
@@ -336,6 +336,22 @@ void AbstractLayout::slotOnChildSelectionHasChanged(BaseDesignIntf* item, bool v
item->setZValue(value ? item->zValue()+1 : item->zValue()-1);
}
int AbstractLayout::layoutSpacing() const
{
return m_layoutSpacing;
}
void AbstractLayout::setLayoutSpacing(int layoutSpacing)
{
if (m_layoutSpacing != layoutSpacing){
int oldValue = m_layoutSpacing;
m_layoutSpacing = layoutSpacing;
int delta = (m_layoutSpacing - oldValue) * (m_children.count()-1);
notify("layoutSpacing", oldValue, m_layoutSpacing);
setWidth(width() + delta);
}
}
bool AbstractLayout::hideEmptyItems() const
{
return m_hideEmptyItems;