@@ -199,13 +199,13 @@ Component::~Component()
199199 foreach (ShapeAnnotation *shape, mpShapesList)
200200 delete shape;
201201
202- // delete the list of all components
203- foreach (Component *component, mpComponentsList)
204- delete component;
202+ // // delete the list of all components
203+ // foreach(Component *component, mpComponentsList)
204+ // delete component;
205205
206- // delete the list of all inherited components
207- foreach (Component *component, mpInheritanceList)
208- delete component;
206+ // // delete the list of all inherited components
207+ // foreach(Component *component, mpInheritanceList)
208+ // delete component;
209209}
210210
211211// ! Parses the result of getIconAnnotation command.
@@ -348,6 +348,9 @@ void Component::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
348348
349349void Component::mousePressEvent (QGraphicsSceneMouseEvent *event)
350350{
351+ // if user is viewing the component in Icon View
352+ if (mpGraphicsView->mIconType == StringHandler::DIAGRAM)
353+ return ;
351354 // if we are creating the connector then make sure user can not select and move components
352355 if ((mpGraphicsView->mIsCreatingConnector ) and !mpParentComponent)
353356 {
@@ -394,6 +397,10 @@ void Component::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
394397
395398void Component::contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
396399{
400+ // if we are viewing some readonly component then don't show the contextmenu
401+ if (mpGraphicsView->mpParentProjectTab ->isReadOnly ())
402+ return ;
403+
397404 // get the root component, it could be either icon or diagram
398405 Component *pComponent = getRootParentComponent ();
399406
0 commit comments