Skip to content

Commit

Permalink
Finish 1.7.11
Browse files Browse the repository at this point in the history
  • Loading branch information
fralx committed Jul 25, 2024
2 parents f3d2efe + 9de9cc3 commit 7c71574
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 33 deletions.
15 changes: 14 additions & 1 deletion limereport/items/lrabstractlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down
3 changes: 2 additions & 1 deletion limereport/items/lrabstractlayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class AbstractLayout: public LayoutDesignIntf
void rebuildChildrenIfNeeded();
void connectToLayout(BaseDesignIntf* item);
void disconnectFromLayout(BaseDesignIntf* item);
virtual void insertItemInLayout(BaseDesignIntf* item);
private:
virtual void sortChildren() = 0;
virtual void divideSpace() = 0;
Expand All @@ -63,7 +64,7 @@ class AbstractLayout: public LayoutDesignIntf
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);
Expand Down
24 changes: 13 additions & 11 deletions limereport/items/lrhorizontallayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion limereport/items/lrhorizontallayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class HorizontalLayout : public AbstractLayout
void sortChildren();
void divideSpace();
void placeItemInLayout(BaseDesignIntf* item);
void insertItemInLayout(BaseDesignIntf* item);
// void insertItemInLayout(BaseDesignIntf* item);
};

} //namespace LimeReport
Expand Down
12 changes: 0 additions & 12 deletions limereport/items/lrverticallayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion limereport/items/lrverticallayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class VerticalLayout : public AbstractLayout
void sortChildren();
void divideSpace();
void placeItemInLayout(BaseDesignIntf* item);
void insertItemInLayout(BaseDesignIntf* item);
// void insertItemInLayout(BaseDesignIntf* item);
};

} // namespace LimeReport
Expand Down
5 changes: 0 additions & 5 deletions limereport/lrbasedesignintf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
2 changes: 1 addition & 1 deletion limereport/lrbasedesignintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ private slots:
QFont m_font;
QColor m_fontColor;
bool m_fixedPos;
qreal m_borderLineSize;
qreal m_borderLineSize;


QRectF m_rect;
Expand Down

0 comments on commit 7c71574

Please sign in to comment.