mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 20:22:58 +03:00
keepTopSpace property added to band
This commit is contained in:
parent
3867527c21
commit
207d7daaa9
@ -106,6 +106,7 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q
|
||||
m_dataSourceName(""),
|
||||
m_autoHeight(true),
|
||||
m_keepBottomSpace(false),
|
||||
m_keepTopSpace(true),
|
||||
m_parentBand(0),
|
||||
m_parentBandName(""),
|
||||
m_bandMarker(0),
|
||||
@ -821,6 +822,20 @@ void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QStrin
|
||||
m_bandNameLabel->updateLabel(newName);
|
||||
}
|
||||
|
||||
bool BandDesignIntf::keepTopSpace() const
|
||||
{
|
||||
return m_keepTopSpace;
|
||||
}
|
||||
|
||||
void BandDesignIntf::setKeepTopSpace(bool value)
|
||||
{
|
||||
if (m_keepTopSpace != value){
|
||||
m_keepTopSpace = value;
|
||||
if (!isLoading())
|
||||
notify("keepTopSpace",!value,value);
|
||||
}
|
||||
}
|
||||
|
||||
bool BandDesignIntf::repeatOnEachRow() const
|
||||
{
|
||||
return m_repeatOnEachRow;
|
||||
@ -969,9 +984,14 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p
|
||||
}
|
||||
restoreLinks();
|
||||
snapshotItemsLayout();
|
||||
arrangeSubItems(pass, dataManager);
|
||||
arrangeSubItems(pass, dataManager);
|
||||
if (autoHeight()){
|
||||
//if keepBottomSpace()&& height()<findMaxBottom()
|
||||
if (!keepTopSpace()) {
|
||||
qreal minTop = findMinTop();
|
||||
foreach (BaseDesignIntf* item, childBaseItems()) {
|
||||
item->setY(item->y() - minTop);
|
||||
}
|
||||
}
|
||||
setHeight(findMaxBottom()+spaceBorder);
|
||||
}
|
||||
if ((maxHeight>0)&&(height()>maxHeight)){
|
||||
|
@ -100,6 +100,7 @@ class BandDesignIntf : public ItemsContainerDesignInft
|
||||
Q_PROPERTY(bool autoHeight READ autoHeight WRITE setAutoHeight )
|
||||
Q_PROPERTY(int bandIndex READ bandIndex WRITE setBandIndex DESIGNABLE false )
|
||||
Q_PROPERTY(bool keepBottomSpace READ keepBottomSpaceOption WRITE setKeepBottomSpaceOption )
|
||||
Q_PROPERTY(bool keepTopSpace READ keepTopSpace WRITE setKeepTopSpace)
|
||||
Q_PROPERTY(QString parentBand READ parentBandName WRITE setParentBandName DESIGNABLE false )
|
||||
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
|
||||
Q_PROPERTY(BrushStyle backgroundBrushStyle READ backgroundBrushStyle WRITE setBackgroundBrushStyle)
|
||||
@ -155,6 +156,9 @@ public:
|
||||
void setKeepBottomSpaceOption(bool value);
|
||||
bool keepBottomSpaceOption() const {return m_keepBottomSpace;}
|
||||
|
||||
bool keepTopSpace() const;
|
||||
void setKeepTopSpace(bool value);
|
||||
|
||||
void addChildBand(BandDesignIntf* band);
|
||||
bool hasChildren(){return !m_childBands.isEmpty();}
|
||||
void removeChildBand(BandDesignIntf* band);
|
||||
@ -245,7 +249,7 @@ public:
|
||||
void copyBookmarks(BandDesignIntf* sourceBand);
|
||||
|
||||
signals:
|
||||
void bandRendered(BandDesignIntf* band);
|
||||
void bandRendered(BandDesignIntf* band);
|
||||
void bandRegistred();
|
||||
protected:
|
||||
void trimToMaxHeight(int maxHeight);
|
||||
@ -279,6 +283,7 @@ private:
|
||||
QString m_dataSourceName;
|
||||
bool m_autoHeight;
|
||||
bool m_keepBottomSpace;
|
||||
bool m_keepTopSpace;
|
||||
BandDesignIntf* m_parentBand;
|
||||
QString m_parentBandName;
|
||||
QList<BandDesignIntf*> m_childBands;
|
||||
|
@ -93,16 +93,27 @@ void ItemsContainerDesignInft::arrangeSubItems(RenderPass pass, DataSourceManage
|
||||
|
||||
qreal ItemsContainerDesignInft::findMaxBottom() const
|
||||
{
|
||||
qreal maxBottom=0;
|
||||
qreal maxBottom = 0;
|
||||
foreach(QGraphicsItem* item,childItems()){
|
||||
BaseDesignIntf* subItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if(subItem)
|
||||
if ( subItem->isVisible() && (subItem->geometry().bottom()>maxBottom) )
|
||||
maxBottom=subItem->geometry().bottom();
|
||||
maxBottom = subItem->geometry().bottom();
|
||||
}
|
||||
return maxBottom;
|
||||
}
|
||||
|
||||
qreal ItemsContainerDesignInft::findMinTop() const{
|
||||
qreal minTop = height();
|
||||
foreach(QGraphicsItem* item,childItems()){
|
||||
BaseDesignIntf* subItem = dynamic_cast<BaseDesignIntf *>(item);
|
||||
if(subItem)
|
||||
if ( subItem->isVisible() && (subItem->geometry().top()<minTop) )
|
||||
minTop = subItem->geometry().top();
|
||||
}
|
||||
return minTop > 0 ? minTop : 0;
|
||||
}
|
||||
|
||||
qreal ItemsContainerDesignInft::findMaxHeight() const
|
||||
{
|
||||
qreal maxHeight=0;
|
||||
|
@ -46,6 +46,7 @@ protected:
|
||||
void arrangeSubItems(RenderPass pass, DataSourceManager *dataManager, ArrangeType type = AsNeeded);
|
||||
qreal findMaxBottom() const;
|
||||
qreal findMaxHeight() const;
|
||||
qreal findMinTop() const;
|
||||
private:
|
||||
QVector<PItemSortContainer> m_containerItems;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user