forked from qt-creator/qt-creator
ModelEditor: Fix calls from derived classes
Change-Id: I4f144bd925bd5f72272e50628d46996b0dba5369 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -166,8 +166,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void swap()
|
void swap()
|
||||||
{
|
{
|
||||||
DiagramController *diagramController = DiagramUndoCommand::diagramController();
|
DiagramController *diagramController = this->diagramController();
|
||||||
MDiagram *diagram = DiagramUndoCommand::diagram();
|
MDiagram *diagram = this->diagram();
|
||||||
foreach (DElement *clonedElement, m_clonedElements) {
|
foreach (DElement *clonedElement, m_clonedElements) {
|
||||||
DElement *activeElement = diagramController->findElement(clonedElement->uid(), diagram);
|
DElement *activeElement = diagramController->findElement(clonedElement->uid(), diagram);
|
||||||
QMT_CHECK(activeElement);
|
QMT_CHECK(activeElement);
|
||||||
@@ -215,8 +215,8 @@ protected:
|
|||||||
|
|
||||||
void remove()
|
void remove()
|
||||||
{
|
{
|
||||||
DiagramController *diagramController = DiagramUndoCommand::diagramController();
|
DiagramController *diagramController = this->diagramController();
|
||||||
MDiagram *diagram = DiagramUndoCommand::diagram();
|
MDiagram *diagram = this->diagram();
|
||||||
bool removed = false;
|
bool removed = false;
|
||||||
for (int i = 0; i < m_clonedElements.count(); ++i) {
|
for (int i = 0; i < m_clonedElements.count(); ++i) {
|
||||||
Clone &clone = m_clonedElements[i];
|
Clone &clone = m_clonedElements[i];
|
||||||
@@ -240,8 +240,8 @@ protected:
|
|||||||
|
|
||||||
void insert()
|
void insert()
|
||||||
{
|
{
|
||||||
DiagramController *diagramController = DiagramUndoCommand::diagramController();
|
DiagramController *diagramController = this->diagramController();
|
||||||
MDiagram *diagram = DiagramUndoCommand::diagram();
|
MDiagram *diagram = this->diagram();
|
||||||
bool inserted = false;
|
bool inserted = false;
|
||||||
for (int i = m_clonedElements.count() - 1; i >= 0; --i) {
|
for (int i = m_clonedElements.count() - 1; i >= 0; --i) {
|
||||||
Clone &clone = m_clonedElements[i];
|
Clone &clone = m_clonedElements[i];
|
||||||
@@ -310,7 +310,7 @@ public:
|
|||||||
{
|
{
|
||||||
Clone clone;
|
Clone clone;
|
||||||
|
|
||||||
MDiagram *diagram = DiagramUndoCommand::diagram();
|
MDiagram *diagram = this->diagram();
|
||||||
clone.m_elementKey = element->uid();
|
clone.m_elementKey = element->uid();
|
||||||
clone.m_indexOfElement = diagram->diagramElements().indexOf(element);
|
clone.m_indexOfElement = diagram->diagramElements().indexOf(element);
|
||||||
QMT_CHECK(clone.m_indexOfElement >= 0);
|
QMT_CHECK(clone.m_indexOfElement >= 0);
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ void BoundaryItem::alignItemSizeToRaster(IResizable::Side adjustHorizontalSide,
|
|||||||
double vertDelta = rect.height() - qRound(rect.height() / rasterHeight) * rasterHeight;
|
double vertDelta = rect.height() - qRound(rect.height() / rasterHeight) * rasterHeight;
|
||||||
|
|
||||||
// make sure the new size is at least the minimum size
|
// make sure the new size is at least the minimum size
|
||||||
QSizeF minimumSize = BoundaryItem::minimumSize();
|
QSizeF minimumSize = this->minimumSize();
|
||||||
while (rect.width() + horizDelta < minimumSize.width()) {
|
while (rect.width() + horizDelta < minimumSize.width()) {
|
||||||
horizDelta += rasterWidth;
|
horizDelta += rasterWidth;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -384,11 +384,11 @@ QSizeF ClassItem::calcMinimumGeometry() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
height += BODY_VERT_BORDER;
|
height += BODY_VERT_BORDER;
|
||||||
if (CustomIconItem *stereotypeIconItem = ObjectItem::stereotypeIconItem()) {
|
if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) {
|
||||||
width = std::max(width, stereotypeIconItem->boundingRect().width() + 2 * BODY_HORIZ_BORDER);
|
width = std::max(width, stereotypeIconItem->boundingRect().width() + 2 * BODY_HORIZ_BORDER);
|
||||||
height += stereotypeIconItem->boundingRect().height();
|
height += stereotypeIconItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
width = std::max(width, stereotypesItem->boundingRect().width() + 2 * BODY_HORIZ_BORDER);
|
width = std::max(width, stereotypesItem->boundingRect().width() + 2 * BODY_HORIZ_BORDER);
|
||||||
height += stereotypesItem->boundingRect().height();
|
height += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
@@ -480,11 +480,11 @@ void ClassItem::updateGeometry()
|
|||||||
}
|
}
|
||||||
|
|
||||||
y += BODY_VERT_BORDER;
|
y += BODY_VERT_BORDER;
|
||||||
if (CustomIconItem *stereotypeIconItem = ObjectItem::stereotypeIconItem()) {
|
if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) {
|
||||||
stereotypeIconItem->setPos(right - stereotypeIconItem->boundingRect().width() - BODY_HORIZ_BORDER, y);
|
stereotypeIconItem->setPos(right - stereotypeIconItem->boundingRect().width() - BODY_HORIZ_BORDER, y);
|
||||||
y += stereotypeIconItem->boundingRect().height();
|
y += stereotypeIconItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
stereotypesItem->setPos(-stereotypesItem->boundingRect().width() / 2.0, y);
|
stereotypesItem->setPos(-stereotypesItem->boundingRect().width() / 2.0, y);
|
||||||
y += stereotypesItem->boundingRect().height();
|
y += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,11 +294,11 @@ QSizeF ComponentItem::calcMinimumGeometry() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
height += BODY_VERT_BORDER;
|
height += BODY_VERT_BORDER;
|
||||||
if (CustomIconItem *stereotypeIconItem = ObjectItem::stereotypeIconItem()) {
|
if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) {
|
||||||
width = std::max(width, stereotypeIconItem->boundingRect().width());
|
width = std::max(width, stereotypeIconItem->boundingRect().width());
|
||||||
height += stereotypeIconItem->boundingRect().height();
|
height += stereotypeIconItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
width = std::max(width, stereotypesItem->boundingRect().width());
|
width = std::max(width, stereotypesItem->boundingRect().width());
|
||||||
height += stereotypesItem->boundingRect().height();
|
height += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
@@ -387,11 +387,11 @@ void ComponentItem::updateGeometry()
|
|||||||
}
|
}
|
||||||
|
|
||||||
y += BODY_VERT_BORDER;
|
y += BODY_VERT_BORDER;
|
||||||
if (CustomIconItem *stereotypeIconItem = ObjectItem::stereotypeIconItem()) {
|
if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) {
|
||||||
stereotypeIconItem->setPos(right - stereotypeIconItem->boundingRect().width() - BODY_HORIZ_BORDER, y);
|
stereotypeIconItem->setPos(right - stereotypeIconItem->boundingRect().width() - BODY_HORIZ_BORDER, y);
|
||||||
y += stereotypeIconItem->boundingRect().height();
|
y += stereotypeIconItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
stereotypesItem->setPos(-stereotypesItem->boundingRect().width() / 2.0, y);
|
stereotypesItem->setPos(-stereotypesItem->boundingRect().width() / 2.0, y);
|
||||||
y += stereotypesItem->boundingRect().height();
|
y += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,13 +172,13 @@ QSizeF DiagramItem::calcMinimumGeometry() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
height += BODY_VERT_BORDER;
|
height += BODY_VERT_BORDER;
|
||||||
if (CustomIconItem *stereotypeIconItem = ObjectItem::stereotypeIconItem()) {
|
if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) {
|
||||||
width = std::max(width, stereotypeIconItem->boundingRect().width() + 2 * BODY_HORIZ_BORDER);
|
width = std::max(width, stereotypeIconItem->boundingRect().width() + 2 * BODY_HORIZ_BORDER);
|
||||||
height += std::max(FOLD_HEIGHT, stereotypeIconItem->boundingRect().height());
|
height += std::max(FOLD_HEIGHT, stereotypeIconItem->boundingRect().height());
|
||||||
} else {
|
} else {
|
||||||
height += FOLD_HEIGHT;
|
height += FOLD_HEIGHT;
|
||||||
}
|
}
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
width = std::max(width, stereotypesItem->boundingRect().width() + 2 * BODY_HORIZ_BORDER);
|
width = std::max(width, stereotypesItem->boundingRect().width() + 2 * BODY_HORIZ_BORDER);
|
||||||
height += stereotypesItem->boundingRect().height();
|
height += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
@@ -265,14 +265,14 @@ void DiagramItem::updateGeometry()
|
|||||||
|
|
||||||
y += BODY_VERT_BORDER;
|
y += BODY_VERT_BORDER;
|
||||||
if (!m_customIcon) {
|
if (!m_customIcon) {
|
||||||
if (CustomIconItem *stereotypeIconItem = ObjectItem::stereotypeIconItem()) {
|
if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) {
|
||||||
stereotypeIconItem->setPos(left + BODY_HORIZ_BORDER, y);
|
stereotypeIconItem->setPos(left + BODY_HORIZ_BORDER, y);
|
||||||
y += std::max(FOLD_HEIGHT, stereotypeIconItem->boundingRect().height());
|
y += std::max(FOLD_HEIGHT, stereotypeIconItem->boundingRect().height());
|
||||||
} else {
|
} else {
|
||||||
y += FOLD_HEIGHT;
|
y += FOLD_HEIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
stereotypesItem->setPos(-stereotypesItem->boundingRect().width() / 2.0, y);
|
stereotypesItem->setPos(-stereotypesItem->boundingRect().width() / 2.0, y);
|
||||||
y += stereotypesItem->boundingRect().height();
|
y += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,11 +225,11 @@ QSizeF ItemItem::calcMinimumGeometry() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
height += BODY_VERT_BORDER;
|
height += BODY_VERT_BORDER;
|
||||||
if (CustomIconItem *stereotypeIconItem = ObjectItem::stereotypeIconItem()) {
|
if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) {
|
||||||
width = std::max(width, stereotypeIconItem->boundingRect().width());
|
width = std::max(width, stereotypeIconItem->boundingRect().width());
|
||||||
height += stereotypeIconItem->boundingRect().height();
|
height += stereotypeIconItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
width = std::max(width, stereotypesItem->boundingRect().width());
|
width = std::max(width, stereotypesItem->boundingRect().width());
|
||||||
height += stereotypesItem->boundingRect().height();
|
height += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
@@ -298,11 +298,11 @@ void ItemItem::updateGeometry()
|
|||||||
}
|
}
|
||||||
|
|
||||||
y += BODY_VERT_BORDER;
|
y += BODY_VERT_BORDER;
|
||||||
if (CustomIconItem *stereotypeIconItem = ObjectItem::stereotypeIconItem()) {
|
if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) {
|
||||||
stereotypeIconItem->setPos(right - stereotypeIconItem->boundingRect().width() - BODY_HORIZ_BORDER, y);
|
stereotypeIconItem->setPos(right - stereotypeIconItem->boundingRect().width() - BODY_HORIZ_BORDER, y);
|
||||||
y += stereotypeIconItem->boundingRect().height();
|
y += stereotypeIconItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
stereotypesItem->setPos(-stereotypesItem->boundingRect().width() / 2.0, y);
|
stereotypesItem->setPos(-stereotypesItem->boundingRect().width() / 2.0, y);
|
||||||
y += stereotypesItem->boundingRect().height();
|
y += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ PackageItem::ShapeGeometry PackageItem::calcMinimumGeometry() const
|
|||||||
double bodyWidth = 0.0;
|
double bodyWidth = 0.0;
|
||||||
|
|
||||||
tabHeight += TAB_VERT_BORDER;
|
tabHeight += TAB_VERT_BORDER;
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
tabWidth = std::max(tabWidth, stereotypesItem->boundingRect().width() + 2 * TAB_HORIZ_BORDER);
|
tabWidth = std::max(tabWidth, stereotypesItem->boundingRect().width() + 2 * TAB_HORIZ_BORDER);
|
||||||
tabHeight += stereotypesItem->boundingRect().height();
|
tabHeight += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
@@ -275,7 +275,7 @@ PackageItem::ShapeGeometry PackageItem::calcMinimumGeometry() const
|
|||||||
height += tabHeight;
|
height += tabHeight;
|
||||||
|
|
||||||
bodyHeight = BODY_VERT_BORDER;
|
bodyHeight = BODY_VERT_BORDER;
|
||||||
if (CustomIconItem *stereotypeIconItem = ObjectItem::stereotypeIconItem()) {
|
if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) {
|
||||||
bodyWidth = std::max(bodyWidth, stereotypeIconItem->boundingRect().width() + 2 * BODY_HORIZ_BORDER);
|
bodyWidth = std::max(bodyWidth, stereotypeIconItem->boundingRect().width() + 2 * BODY_HORIZ_BORDER);
|
||||||
bodyHeight += stereotypeIconItem->boundingRect().height();
|
bodyHeight += stereotypeIconItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
@@ -342,7 +342,7 @@ void PackageItem::updateGeometry()
|
|||||||
y += height;
|
y += height;
|
||||||
|
|
||||||
y += BODY_VERT_BORDER;
|
y += BODY_VERT_BORDER;
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
stereotypesItem->setPos(-stereotypesItem->boundingRect().width() / 2.0, y);
|
stereotypesItem->setPos(-stereotypesItem->boundingRect().width() / 2.0, y);
|
||||||
y += stereotypesItem->boundingRect().height();
|
y += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
@@ -366,7 +366,7 @@ void PackageItem::updateGeometry()
|
|||||||
m_shape->setPolygon(polygon);
|
m_shape->setPolygon(polygon);
|
||||||
|
|
||||||
y += TAB_VERT_BORDER;
|
y += TAB_VERT_BORDER;
|
||||||
if (StereotypesItem *stereotypesItem = ObjectItem::stereotypesItem()) {
|
if (StereotypesItem *stereotypesItem = this->stereotypesItem()) {
|
||||||
stereotypesItem->setPos(left + TAB_HORIZ_BORDER, y);
|
stereotypesItem->setPos(left + TAB_HORIZ_BORDER, y);
|
||||||
y += stereotypesItem->boundingRect().height();
|
y += stereotypesItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
@@ -376,7 +376,7 @@ void PackageItem::updateGeometry()
|
|||||||
}
|
}
|
||||||
y += TAB_VERT_BORDER;
|
y += TAB_VERT_BORDER;
|
||||||
y += BODY_VERT_BORDER;
|
y += BODY_VERT_BORDER;
|
||||||
if (CustomIconItem *stereotypeIconItem = ObjectItem::stereotypeIconItem()) {
|
if (CustomIconItem *stereotypeIconItem = this->stereotypeIconItem()) {
|
||||||
stereotypeIconItem->setPos(right - stereotypeIconItem->boundingRect().width() - BODY_HORIZ_BORDER, y);
|
stereotypeIconItem->setPos(right - stereotypeIconItem->boundingRect().width() - BODY_HORIZ_BORDER, y);
|
||||||
y += stereotypeIconItem->boundingRect().height();
|
y += stereotypeIconItem->boundingRect().height();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user