forked from qt-creator/qt-creator
modeleditor: Add icon name to object outline for intersection
Change-Id: I09b65a675e4d2205d0be2b1ca1687f2ceffe4285 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -291,6 +291,18 @@ bool ClassItem::intersectShapeWithLine(const QLineF &line, QPointF *intersection
|
|||||||
QList<QPolygonF> polygons = m_customIcon->outline();
|
QList<QPolygonF> polygons = m_customIcon->outline();
|
||||||
for (int i = 0; i < polygons.size(); ++i)
|
for (int i = 0; i < polygons.size(); ++i)
|
||||||
polygons[i].translate(object()->pos() + object()->rect().topLeft());
|
polygons[i].translate(object()->pos() + object()->rect().topLeft());
|
||||||
|
if (shapeIcon().textAlignment() == qmt::StereotypeIcon::TextalignBelow) {
|
||||||
|
if (nameItem()) {
|
||||||
|
QPolygonF polygon(nameItem()->boundingRect());
|
||||||
|
polygon.translate(object()->pos() + nameItem()->pos());
|
||||||
|
polygons.append(polygon);
|
||||||
|
}
|
||||||
|
if (m_contextLabel) {
|
||||||
|
QPolygonF polygon(m_contextLabel->boundingRect());
|
||||||
|
polygon.translate(object()->pos() + m_contextLabel->pos());
|
||||||
|
polygons.append(polygon);
|
||||||
|
}
|
||||||
|
}
|
||||||
return GeometryUtilities::intersect(polygons, line, nullptr, intersectionPoint, intersectionLine);
|
return GeometryUtilities::intersect(polygons, line, nullptr, intersectionPoint, intersectionLine);
|
||||||
}
|
}
|
||||||
QPolygonF polygon;
|
QPolygonF polygon;
|
||||||
|
@@ -164,6 +164,18 @@ bool ComponentItem::intersectShapeWithLine(const QLineF &line, QPointF *intersec
|
|||||||
QList<QPolygonF> polygons = m_customIcon->outline();
|
QList<QPolygonF> polygons = m_customIcon->outline();
|
||||||
for (int i = 0; i < polygons.size(); ++i)
|
for (int i = 0; i < polygons.size(); ++i)
|
||||||
polygons[i].translate(object()->pos() + object()->rect().topLeft());
|
polygons[i].translate(object()->pos() + object()->rect().topLeft());
|
||||||
|
if (shapeIcon().textAlignment() == qmt::StereotypeIcon::TextalignBelow) {
|
||||||
|
if (nameItem()) {
|
||||||
|
QPolygonF polygon(nameItem()->boundingRect());
|
||||||
|
polygon.translate(object()->pos() + nameItem()->pos());
|
||||||
|
polygons.append(polygon);
|
||||||
|
}
|
||||||
|
if (m_contextLabel) {
|
||||||
|
QPolygonF polygon(m_contextLabel->boundingRect());
|
||||||
|
polygon.translate(object()->pos() + m_contextLabel->pos());
|
||||||
|
polygons.append(polygon);
|
||||||
|
}
|
||||||
|
}
|
||||||
return GeometryUtilities::intersect(polygons, line, nullptr, intersectionPoint, intersectionLine);
|
return GeometryUtilities::intersect(polygons, line, nullptr, intersectionPoint, intersectionLine);
|
||||||
}
|
}
|
||||||
QPolygonF polygon;
|
QPolygonF polygon;
|
||||||
|
@@ -126,6 +126,13 @@ bool DiagramItem::intersectShapeWithLine(const QLineF &line, QPointF *intersecti
|
|||||||
QList<QPolygonF> polygons = m_customIcon->outline();
|
QList<QPolygonF> polygons = m_customIcon->outline();
|
||||||
for (int i = 0; i < polygons.size(); ++i)
|
for (int i = 0; i < polygons.size(); ++i)
|
||||||
polygons[i].translate(object()->pos() + object()->rect().topLeft());
|
polygons[i].translate(object()->pos() + object()->rect().topLeft());
|
||||||
|
if (shapeIcon().textAlignment() == qmt::StereotypeIcon::TextalignBelow) {
|
||||||
|
if (nameItem()) {
|
||||||
|
QPolygonF polygon(nameItem()->boundingRect());
|
||||||
|
polygon.translate(object()->pos() + nameItem()->pos());
|
||||||
|
polygons.append(polygon);
|
||||||
|
}
|
||||||
|
}
|
||||||
return GeometryUtilities::intersect(polygons, line, nullptr, intersectionPoint, intersectionLine);
|
return GeometryUtilities::intersect(polygons, line, nullptr, intersectionPoint, intersectionLine);
|
||||||
}
|
}
|
||||||
QPolygonF polygon;
|
QPolygonF polygon;
|
||||||
|
@@ -134,6 +134,18 @@ bool ItemItem::intersectShapeWithLine(const QLineF &line, QPointF *intersectionP
|
|||||||
QList<QPolygonF> polygons = m_customIcon->outline();
|
QList<QPolygonF> polygons = m_customIcon->outline();
|
||||||
for (int i = 0; i < polygons.size(); ++i)
|
for (int i = 0; i < polygons.size(); ++i)
|
||||||
polygons[i].translate(object()->pos() + object()->rect().topLeft());
|
polygons[i].translate(object()->pos() + object()->rect().topLeft());
|
||||||
|
if (shapeIcon().textAlignment() == qmt::StereotypeIcon::TextalignBelow) {
|
||||||
|
if (nameItem()) {
|
||||||
|
QPolygonF polygon(nameItem()->boundingRect());
|
||||||
|
polygon.translate(object()->pos() + nameItem()->pos());
|
||||||
|
polygons.append(polygon);
|
||||||
|
}
|
||||||
|
if (m_contextLabel) {
|
||||||
|
QPolygonF polygon(m_contextLabel->boundingRect());
|
||||||
|
polygon.translate(object()->pos() + m_contextLabel->pos());
|
||||||
|
polygons.append(polygon);
|
||||||
|
}
|
||||||
|
}
|
||||||
return GeometryUtilities::intersect(polygons, line, nullptr, intersectionPoint, intersectionLine);
|
return GeometryUtilities::intersect(polygons, line, nullptr, intersectionPoint, intersectionLine);
|
||||||
}
|
}
|
||||||
QRectF rect = object()->rect();
|
QRectF rect = object()->rect();
|
||||||
|
@@ -145,6 +145,18 @@ bool PackageItem::intersectShapeWithLine(const QLineF &line, QPointF *intersecti
|
|||||||
QList<QPolygonF> polygons = m_customIcon->outline();
|
QList<QPolygonF> polygons = m_customIcon->outline();
|
||||||
for (int i = 0; i < polygons.size(); ++i)
|
for (int i = 0; i < polygons.size(); ++i)
|
||||||
polygons[i].translate(object()->pos() + object()->rect().topLeft());
|
polygons[i].translate(object()->pos() + object()->rect().topLeft());
|
||||||
|
if (shapeIcon().textAlignment() == qmt::StereotypeIcon::TextalignBelow) {
|
||||||
|
if (nameItem()) {
|
||||||
|
QPolygonF polygon(nameItem()->boundingRect());
|
||||||
|
polygon.translate(object()->pos() + nameItem()->pos());
|
||||||
|
polygons.append(polygon);
|
||||||
|
}
|
||||||
|
if (m_contextLabel) {
|
||||||
|
QPolygonF polygon(m_contextLabel->boundingRect());
|
||||||
|
polygon.translate(object()->pos() + m_contextLabel->pos());
|
||||||
|
polygons.append(polygon);
|
||||||
|
}
|
||||||
|
}
|
||||||
return GeometryUtilities::intersect(polygons, line, nullptr, intersectionPoint, intersectionLine);
|
return GeometryUtilities::intersect(polygons, line, nullptr, intersectionPoint, intersectionLine);
|
||||||
}
|
}
|
||||||
QPolygonF polygon;
|
QPolygonF polygon;
|
||||||
|
Reference in New Issue
Block a user