Skip to content

Commit

Permalink
ticket:4505 Use the diagram annotation when connector is inside the c…
Browse files Browse the repository at this point in the history
…omponent instance
  • Loading branch information
adeas31 committed Oct 23, 2017
1 parent c3e0976 commit f3156d1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
25 changes: 21 additions & 4 deletions OMEdit/OMEditGUI/Component/Component.cpp
Expand Up @@ -1580,11 +1580,10 @@ void Component::createClassShapes()
pMainWindow->getLibraryWidget()->getLibraryTreeModel()->showModelWidget(mpLibraryTreeItem, false);
}
GraphicsView *pGraphicsView = mpLibraryTreeItem->getModelWidget()->getIconGraphicsView();
/* Ticket:4505
* If extends class is connector then don't use the diagram annotation.
/* ticket:4505
* Only use the diagram annotation when connector is inside the component instance.
*/
if (mpLibraryTreeItem->isConnector() && mpGraphicsView->getViewType() == StringHandler::Diagram &&
mComponentType != Component::Port && mComponentType != Component::Extend) {
if (mpLibraryTreeItem->isConnector() && mpGraphicsView->getViewType() == StringHandler::Diagram && canUseDiagramAnnotation()) {
mpLibraryTreeItem->getModelWidget()->loadDiagramView();
if (mpLibraryTreeItem->getModelWidget()->getDiagramGraphicsView()->hasAnnotation()) {
pGraphicsView = mpLibraryTreeItem->getModelWidget()->getDiagramGraphicsView();
Expand Down Expand Up @@ -1912,6 +1911,24 @@ void Component::updateToolTip()
}
}

/*!
* \brief Component::canUseDiagramAnnotation
* If the component is a port component or has a port component as parent in the hirerchy
* then we should not use the diagram annotation.
* \return
*/
bool Component::canUseDiagramAnnotation()
{
Component *pComponent = this;
while (pComponent->getParentComponent()) {
if (pComponent->getComponentType() == Component::Port) {
return false;
}
pComponent = pComponent->getParentComponent();
}
return true;
}

void Component::updatePlacementAnnotation()
{
// Add component annotation.
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/Component/Component.h
Expand Up @@ -307,6 +307,7 @@ class Component : public QObject, public QGraphicsItem
QString getParameterDisplayStringFromExtendsParameters(QString parameterName, QString modifierString);
bool checkEnumerationDisplayString(QString &displayString, const QString &typeName);
void updateToolTip();
bool canUseDiagramAnnotation();
signals:
void added();
void transformChange();
Expand Down

0 comments on commit f3156d1

Please sign in to comment.