0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00

Finish 1.7.11

This commit is contained in:
Arin Alex 2024-07-25 18:32:44 +03:00
commit 7c7157417a
8 changed files with 32 additions and 33 deletions

View File

@ -48,7 +48,7 @@ void AbstractLayout::setLayoutType(const LayoutType& layoutType)
void AbstractLayout::addChild(BaseDesignIntf* item, bool updateSize)
{
placeItemInLayout(item);
if (updateSize) placeItemInLayout(item);
m_children.append(item);
item->setParentItem(this);
@ -321,6 +321,19 @@ BaseDesignIntf *AbstractLayout::findPrior(BaseDesignIntf *item)
return 0;
}
void AbstractLayout::insertItemInLayout(BaseDesignIntf *item){
bool inserted = false;
for (int i=0; i<layoutsChildren().length(); ++i){
BaseDesignIntf* child = layoutsChildren()[i];
if (child->pos() == item->pos()){
layoutsChildren().insert(i, item);
inserted = true;
break;
}
}
if (!inserted) layoutsChildren().append(item);
}
void AbstractLayout::slotOnChildDestroy(QObject* child)
{
m_children.removeAll(static_cast<BaseDesignIntf*>(child));

View File

@ -55,6 +55,7 @@ protected:
void rebuildChildrenIfNeeded();
void connectToLayout(BaseDesignIntf* item);
void disconnectFromLayout(BaseDesignIntf* item);
virtual void insertItemInLayout(BaseDesignIntf* item);
private:
virtual void sortChildren() = 0;
virtual void divideSpace() = 0;
@ -63,7 +64,7 @@ private:
virtual BaseDesignIntf* findNext(BaseDesignIntf *item);
virtual BaseDesignIntf* findPrior(BaseDesignIntf *item);
virtual void placeItemInLayout(BaseDesignIntf* item) = 0;
virtual void insertItemInLayout(BaseDesignIntf* item) = 0;
private slots:
void slotOnChildDestroy(QObject *child);
void slotOnChildGeometryChanged(QObject*item, QRectF newGeometry, QRectF oldGeometry);

View File

@ -238,16 +238,18 @@ void HorizontalLayout::placeItemInLayout(BaseDesignIntf* item)
item->setPos(0, 0);
}
void HorizontalLayout::insertItemInLayout(BaseDesignIntf* item)
{
foreach (BaseDesignIntf* child, childBaseItems()) {
if (child->pos() == item->pos()){
int index = layoutsChildren().indexOf(child)-1;
layoutsChildren().insert(index, item);
child->setPos(item->pos().x()+item->width(), 0);
break;
}
}
}
// void HorizontalLayout::insertItemInLayout(BaseDesignIntf* item)
// {
// bool inserted = false;
// for (int i=0; i<layoutsChildren().length(); ++i){
// BaseDesignIntf* child = layoutsChildren()[i];
// if (child->pos() == item->pos()){
// layoutsChildren().insert(i, item);
// inserted = true;
// break;
// }
// }
// if (!inserted) layoutsChildren().append(item);
// }
} // namespace LimeReport

View File

@ -62,7 +62,7 @@ private:
void sortChildren();
void divideSpace();
void placeItemInLayout(BaseDesignIntf* item);
void insertItemInLayout(BaseDesignIntf* item);
// void insertItemInLayout(BaseDesignIntf* item);
};
} //namespace LimeReport

View File

@ -187,16 +187,4 @@ void VerticalLayout::placeItemInLayout(BaseDesignIntf* item)
item->setPos(0, 0);
}
void VerticalLayout::insertItemInLayout(BaseDesignIntf* item)
{
foreach (BaseDesignIntf* child, childBaseItems()) {
if (child->pos() == item->pos()){
int index = layoutsChildren().indexOf(child)-1;
layoutsChildren().insert(index, item);
child->setPos(0, item->pos().y()+item->height());
break;
}
}
}
} // namespace LimeReport

View File

@ -27,7 +27,7 @@ private:
void sortChildren();
void divideSpace();
void placeItemInLayout(BaseDesignIntf* item);
void insertItemInLayout(BaseDesignIntf* item);
// void insertItemInLayout(BaseDesignIntf* item);
};
} // namespace LimeReport

View File

@ -432,13 +432,8 @@ void BaseDesignIntf::paint(QPainter *ppainter, const QStyleOptionGraphicsItem *o
drawBorder(ppainter, rect());
if(m_shadow)
drawShadow(ppainter, rect(), 6);
// if (m_joinMarkerOn) { drawMarker(ppainter, Const::JOIN_COLOR);}
// if (isSelected() && !m_joinMarkerOn) {drawMarker(ppainter, Const::SELECTION_COLOR);}
drawResizeZone(ppainter);
ppainter->restore();
// if (m_hovered) ppainter->drawImage(
// QRectF(QPointF(rect().topRight().x()-24, rect().bottomLeft().y()-24),
// QSizeF(24, 24)),QImage(":/items/images/settings.png"));
}
QColor calcColor(QColor color){