Skip to content
Commit f8d4dbf7 authored by Oliver Kellogg's avatar Oliver Kellogg
Browse files

Permit creation of ports using toolbar for component diagram:

umbrello/widgets/toolbarstateonewidget.cpp
- In function mouseReleaseWidget() admit
    currentWidget()->baseType() == WidgetBase::wt_Component
  to the call of setWidget(currentWidget())
- In function setWidget() handling of widgetType() == WidgetBase::wt_Pin,
  add handling of m_firstObject->baseType() == WidgetBase::wt_Component:
  - Open a dialog querying the user for a new port name
  - If user confirmed port creation then
    - Let Object_Factory create a UML Port object of given name.
      The object is owned by the UML Component underlying m_firstObject.
    - Let Widget_Factory create a PortWidget representing the UML Port and
      assign this widget to `umlwidget'.

umbrello/worktoolbar.cpp
- In function slotCheckToolBar(Uml::DiagramType::Enum) switch (m_Type) case
  Uml::DiagramType::Component, insertHotBtn(tbb_Pin).
  tbb_Pin is reused for ports.

umbrello/widgets/portwidget.cpp
- In function attachToOwningComponent() prevent the port from being dropped
  underneath its owning component (thus becoming inaccessible).
  This is achieved as follows:
  If scenePos.x() is in the range
    [ owner->x() : owner->x() + owner->width() ]
  and scenePos.y() is in the range
    [ owner->y() : owner->y() + owner->height() ]
  then
    if scenePos.y() is in the top half of owner then
      setY(owner->y() - height())
    else
      setY(owner->y() + owner->height())

CCBUG:115269
parent ed9a487b
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment