diff options
author | Jochen Becher <[email protected]> | 2018-01-11 20:26:15 +0100 |
---|---|---|
committer | Jochen Becher <[email protected]> | 2018-01-12 16:49:01 +0000 |
commit | d12e74265c2813a71cf0a3c25f4c834c64358bb0 (patch) | |
tree | 4de2ea26da5336a9a8189c3c4ffb2c9f3cf16ef9 /src/libs/modelinglib | |
parent | 304e1c0bbaf8fb0997f249da2db4f21a62cc0e0e (diff) |
ModelEditor: Fix regression with item label
Change-Id: I081d30cb3451681d049a73fe2f0fb04f537bb437
Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/libs/modelinglib')
-rw-r--r-- | src/libs/modelinglib/qmt/diagram_scene/items/itemitem.cpp | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/src/libs/modelinglib/qmt/diagram_scene/items/itemitem.cpp b/src/libs/modelinglib/qmt/diagram_scene/items/itemitem.cpp index 525fdb56be8..a2e3a54df7a 100644 --- a/src/libs/modelinglib/qmt/diagram_scene/items/itemitem.cpp +++ b/src/libs/modelinglib/qmt/diagram_scene/items/itemitem.cpp @@ -240,30 +240,34 @@ void ItemItem::updateGeometry() if (m_shape) m_shape->setRect(rect); - switch (shapeIcon().textAlignment()) { - case qmt::StereotypeIcon::TextalignBelow: - y += height + BODY_VERT_BORDER; - break; - case qmt::StereotypeIcon::TextalignCenter: - { - double h = 0.0; - if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) - h += stereotypeIconItem->boundingRect().height(); - if (StereotypesItem *stereotypesItem = this->stereotypesItem()) - h += stereotypesItem->boundingRect().height(); - if (nameItem()) - h += nameItem()->boundingRect().height(); - if (m_contextLabel) - h += m_contextLabel->height(); - y = top + (height - h) / 2.0; - break; - } - case qmt::StereotypeIcon::TextalignNone: - // nothing to do - break; - case qmt::StereotypeIcon::TextalignTop: + if (m_customIcon) { + switch (shapeIcon().textAlignment()) { + case qmt::StereotypeIcon::TextalignBelow: + y += height + BODY_VERT_BORDER; + break; + case qmt::StereotypeIcon::TextalignCenter: + { + double h = 0.0; + if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) + h += stereotypeIconItem->boundingRect().height(); + if (StereotypesItem *stereotypesItem = this->stereotypesItem()) + h += stereotypesItem->boundingRect().height(); + if (nameItem()) + h += nameItem()->boundingRect().height(); + if (m_contextLabel) + h += m_contextLabel->height(); + y = top + (height - h) / 2.0; + break; + } + case qmt::StereotypeIcon::TextalignNone: + // nothing to do + break; + case qmt::StereotypeIcon::TextalignTop: + y += BODY_VERT_BORDER; + break; + } + } else { y += BODY_VERT_BORDER; - break; } if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) { stereotypeIconItem->setPos(right - stereotypeIconItem->boundingRect().width() - BODY_HORIZ_BORDER, y); |