Skip to content

Commit

Permalink
Don't return something from a void function
Browse files Browse the repository at this point in the history
Removed some unnecessary functions from Element.h
  • Loading branch information
adeas31 committed Dec 2, 2020
1 parent d3ff215 commit b2b2bfb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
8 changes: 4 additions & 4 deletions OMEdit/OMEditLIB/Annotations/TextAnnotation.cpp
Expand Up @@ -547,11 +547,11 @@ void TextAnnotation::updateTextStringHelper(QRegExp regExp)
if (!textValue.isEmpty()) {
QString unit = "";
QString displaytUnit = "";
Element *pComponent = mpComponent->getRootParentComponent()->getComponentByName(variable);
if (pComponent) {
displaytUnit = pComponent->getDerivedClassModifierValue("displaytUnit");
Element *pElement = mpComponent->getRootParentComponent()->getElementByName(variable);
if (pElement) {
displaytUnit = pElement->getDerivedClassModifierValue("displaytUnit");
if (displaytUnit.isEmpty()) {
unit = pComponent->getDerivedClassModifierValue("unit");
unit = pElement->getDerivedClassModifierValue("unit");
displaytUnit = unit;
}
}
Expand Down
16 changes: 8 additions & 8 deletions OMEdit/OMEditLIB/Element/Element.cpp
Expand Up @@ -1315,7 +1315,7 @@ void Element::applyRotation(qreal angle)
angle = 0;
}
mTransformation.setRotateAngle(angle);
updateComponentTransformations(oldTransformation, false);
updateElementTransformations(oldTransformation, false);
}

void Element::addConnectionDetails(LineAnnotation *pConnectorLineAnnotation)
Expand Down Expand Up @@ -1745,7 +1745,7 @@ void Element::updateElementTransformations(const Transformation &oldTransformati

/*!
* \brief Element::handleOMSElementDoubleClick
* Handles the mouse double click for OMS component.
* Handles the mouse double click for OMS element.
*/
void Element::handleOMSElementDoubleClick()
{
Expand All @@ -1772,23 +1772,23 @@ void Element::setBusComponent(Element *pBusElement)
}

/*!
* \brief Element::getComponentByName
* Finds the component by name.
* \param componentName
* \brief Element::getElementByName
* Finds the element by name.
* \param elementName
* \return
*/
Element *Element::getComponentByName(const QString &componentName)
Element *Element::getElementByName(const QString &elementName)
{
Element *pElementFound = 0;
foreach (Element *pElement, getElementsList()) {
if (pElement->getElementInfo() && pElement->getName().compare(componentName) == 0) {
if (pElement->getElementInfo() && pElement->getName().compare(elementName) == 0) {
pElementFound = pElement;
return pElementFound;
}
}
/* if is not found in components list then look into the inherited components list. */
foreach (Element *pInheritedElement, getInheritedElementsList()) {
pElementFound = pInheritedElement->getElementByName(componentName);
pElementFound = pInheritedElement->getElementByName(elementName);
if (pElementFound) {
return pElementFound;
}
Expand Down
5 changes: 1 addition & 4 deletions OMEdit/OMEditLIB/Element/Element.h
Expand Up @@ -278,14 +278,11 @@ class Element : public QObject, public QGraphicsItem
void removeInterfacePoint(QString interfaceName);
void adjustInterfacePoints();
void updateElementTransformations(const Transformation &oldTransformation, const bool positionChanged);
void updateComponentTransformations(const Transformation &oldTransformation, const bool positionChanged) {updateElementTransformations(oldTransformation, positionChanged);}
void handleOMSElementDoubleClick();
void handleOMSComponentDoubleClick() {return handleOMSElementDoubleClick();}
bool isInBus() {return mpBusComponent != 0;}
void setBusComponent(Element *pBusComponent);
Element* getBusComponent() {return mpBusComponent;}
Element* getComponentByName(const QString &componentName);
Element* getElementByName(const QString &componentName) {return getComponentByName(componentName);}
Element* getElementByName(const QString &componentName);

Transformation mTransformation;
Transformation mOldTransformation;
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -3441,7 +3441,7 @@ void GraphicsView::mouseReleaseEvent(QMouseEvent *event)
Transformation oldTransformation = pElement->mTransformation;
QPointF positionDifference = pElement->scenePos() - pElement->getOldScenePosition();
pElement->mTransformation.adjustPosition(positionDifference.x(), positionDifference.y());
pElement->updateComponentTransformations(oldTransformation, true);
pElement->updateElementTransformations(oldTransformation, true);
hasComponentMoved = true;
}
}
Expand Down Expand Up @@ -3491,7 +3491,7 @@ bool GraphicsView::handleDoubleClickOnComponent(QMouseEvent *event)
if (mpModelWidget->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::CompositeModel) {
pRootComponent->showSubModelAttributes();
} else if (mpModelWidget->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::OMS) {
pRootComponent->handleOMSComponentDoubleClick();
pRootComponent->handleOMSElementDoubleClick();
} else {
removeCurrentTransition();
/* ticket:4401 Open component class with shift + double click */
Expand Down

0 comments on commit b2b2bfb

Please sign in to comment.