mirror of
https://github.com/fralx/LimeReport.git
synced 2025-10-01 11:31:10 +03:00
Reassign children from child layout to parent layout
This commit is contained in:
@@ -57,22 +57,7 @@ void AbstractLayout::addChild(BaseDesignIntf* item, bool updateSize)
|
||||
item->setFixedPos(true);
|
||||
item->setPossibleResizeDirectionFlags(ResizeRight | ResizeBottom);
|
||||
|
||||
connect(
|
||||
item, SIGNAL(destroyed(QObject*)),
|
||||
this, SLOT(slotOnChildDestroy(QObject*))
|
||||
);
|
||||
connect(
|
||||
item,SIGNAL(geometryChanged(QObject*,QRectF,QRectF)),
|
||||
this,SLOT(slotOnChildGeometryChanged(QObject*,QRectF,QRectF))
|
||||
);
|
||||
connect(
|
||||
item, SIGNAL(itemVisibleHasChanged(BaseDesignIntf*)),
|
||||
this, SLOT(slotOnChildVisibleHasChanged(BaseDesignIntf*))
|
||||
);
|
||||
connect(
|
||||
item, SIGNAL(itemSelectedHasBeenChanged(BaseDesignIntf*,bool)),
|
||||
this, SLOT(slotOnChildSelectionHasChanged(BaseDesignIntf*,bool))
|
||||
);
|
||||
connectTolayout(item);
|
||||
|
||||
if (updateSize){
|
||||
relocateChildren();
|
||||
@@ -267,6 +252,26 @@ void AbstractLayout::rebuildChildrenIfNeeded(){
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractLayout::connectTolayout(BaseDesignIntf *item)
|
||||
{
|
||||
connect(
|
||||
item, SIGNAL(destroyed(QObject*)),
|
||||
this, SLOT(slotOnChildDestroy(QObject*))
|
||||
);
|
||||
connect(
|
||||
item,SIGNAL(geometryChanged(QObject*,QRectF,QRectF)),
|
||||
this,SLOT(slotOnChildGeometryChanged(QObject*,QRectF,QRectF))
|
||||
);
|
||||
connect(
|
||||
item, SIGNAL(itemVisibleHasChanged(BaseDesignIntf*)),
|
||||
this, SLOT(slotOnChildVisibleHasChanged(BaseDesignIntf*))
|
||||
);
|
||||
connect(
|
||||
item, SIGNAL(itemSelectedHasBeenChanged(BaseDesignIntf*,bool)),
|
||||
this, SLOT(slotOnChildSelectionHasChanged(BaseDesignIntf*,bool))
|
||||
);
|
||||
}
|
||||
|
||||
BaseDesignIntf *AbstractLayout::findNext(BaseDesignIntf *item)
|
||||
{
|
||||
rebuildChildrenIfNeeded();
|
||||
|
@@ -52,6 +52,7 @@ protected:
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
void updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight);
|
||||
void rebuildChildrenIfNeeded();
|
||||
void connectTolayout(BaseDesignIntf* item);
|
||||
private:
|
||||
virtual void sortChildren() = 0;
|
||||
virtual void divideSpace() = 0;
|
||||
|
@@ -171,9 +171,14 @@ void HorizontalLayout::updateLayoutSize()
|
||||
void HorizontalLayout::relocateChildren()
|
||||
{
|
||||
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
|
||||
QList<BaseDesignIntf*> newChildren;
|
||||
if (layoutsChildren().count() < childItems().size()-1){
|
||||
auto oldChildren = layoutsChildren();
|
||||
layoutsChildren().clear();
|
||||
foreach (BaseDesignIntf* item, childBaseItems()) {
|
||||
if (!oldChildren.contains(item)) {
|
||||
newChildren.append(item);
|
||||
}
|
||||
layoutsChildren().append(item);
|
||||
}
|
||||
}
|
||||
@@ -188,6 +193,10 @@ void HorizontalLayout::relocateChildren()
|
||||
}
|
||||
}
|
||||
setIsRelocating(false);
|
||||
|
||||
for (BaseDesignIntf* item : newChildren) {
|
||||
connectTolayout(item);
|
||||
}
|
||||
}
|
||||
|
||||
void HorizontalLayout::divideSpace(){
|
||||
|
@@ -57,9 +57,14 @@ void VerticalLayout::updateLayoutSize()
|
||||
void VerticalLayout::relocateChildren()
|
||||
{
|
||||
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
|
||||
QList<BaseDesignIntf*> newChildren;
|
||||
if (layoutsChildren().count() < childItems().size() - 1){
|
||||
auto oldChildren = layoutsChildren();
|
||||
layoutsChildren().clear();
|
||||
foreach (BaseDesignIntf* item, childBaseItems()) {
|
||||
if (!oldChildren.contains(item)) {
|
||||
newChildren.append(item);
|
||||
}
|
||||
layoutsChildren().append(item);
|
||||
}
|
||||
}
|
||||
@@ -74,6 +79,10 @@ void VerticalLayout::relocateChildren()
|
||||
}
|
||||
}
|
||||
setIsRelocating(false);
|
||||
|
||||
for (BaseDesignIntf* item : newChildren) {
|
||||
connectTolayout(item);
|
||||
}
|
||||
}
|
||||
|
||||
bool VerticalLayout::canBeSplitted(int height) const
|
||||
|
Reference in New Issue
Block a user