Skip to content

Commit

Permalink
Handle component double click for built in types like Real, Integer etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Oct 21, 2015
1 parent 80cb3a4 commit 732bcca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 15 additions & 2 deletions OMEdit/OMEditGUI/Component/Component.cpp
Expand Up @@ -1502,12 +1502,19 @@ void Component::showTLMAttributes()
pTLMComponentAttributes->exec();
}

/*! Event when mouse is double clicked on a component.
* Shows the component properties dialog.
/*!
* \brief Component::mouseDoubleClickEvent
* Event when mouse is double clicked on a component.
* Shows the component properties dialog.
* \param event
*/
void Component::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
Q_UNUSED(event);
// if user double clicks the built in type like Integer, Real etc.
if (!mpLibraryTreeItem) {
return;
}
LibraryTreeItem *pLibraryTreeItem = mpGraphicsView->getModelWidget()->getLibraryTreeItem();
if(pLibraryTreeItem->getLibraryType()== LibraryTreeItem::TLM) {
emit showTLMAttributes();
Expand All @@ -1519,6 +1526,12 @@ void Component::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
}
}

/*!
* \brief Component::contextMenuEvent
* Reimplementation of contextMenuEvent.\n
* Creates a context menu for the component.\n
* \param event
*/
void Component::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
// if user right clicks the built in type like Integer, Real etc. we don't show the context menu.
Expand Down
4 changes: 4 additions & 0 deletions OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -986,18 +986,22 @@ void GraphicsView::createActions()
mpBringToFrontAction = new QAction(QIcon(":/Resources/icons/bring-to-front.svg"), tr("Bring to Front"), this);
mpBringToFrontAction->setStatusTip(tr("Brings the item to front"));
mpBringToFrontAction->setDisabled(isSystemLibrary);
mpBringToFrontAction->setDisabled(true);
// Bring Forward Action
mpBringForwardAction = new QAction(QIcon(":/Resources/icons/bring-forward.svg"), tr("Bring Forward"), this);
mpBringForwardAction->setStatusTip(tr("Brings the item one level forward"));
mpBringForwardAction->setDisabled(isSystemLibrary);
mpBringForwardAction->setDisabled(true);
// Send To Back Action
mpSendToBackAction = new QAction(QIcon(":/Resources/icons/send-to-back.svg"), tr("Send to Back"), this);
mpSendToBackAction->setStatusTip(tr("Sends the item to back"));
mpSendToBackAction->setDisabled(isSystemLibrary);
mpSendToBackAction->setDisabled(true);
// Send Backward Action
mpSendBackwardAction = new QAction(QIcon(":/Resources/icons/send-backward.svg"), tr("Send Backward"), this);
mpSendBackwardAction->setStatusTip(tr("Sends the item one level backward"));
mpSendBackwardAction->setDisabled(isSystemLibrary);
mpSendBackwardAction->setDisabled(true);
// Rotate ClockWise Action
mpRotateClockwiseAction = new QAction(QIcon(":/Resources/icons/rotateclockwise.svg"), tr("Rotate Clockwise"), this);
mpRotateClockwiseAction->setStatusTip(tr("Rotates the item clockwise"));
Expand Down

0 comments on commit 732bcca

Please sign in to comment.