Commit 23e23aa4 authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Add adding class, interface, datatype and enums from diagram class widget.

CCBUG:373383
parent 410efbf8
......@@ -1339,6 +1339,10 @@ void ListPopupMenu::makeClassifierPopup(ClassifierWidget *c)
insert(mt_Attribute, menu, Icon_Utils::SmallIcon(Icon_Utils::it_Public_Attribute), i18n("Attribute..."));
insert(mt_Operation, menu, Icon_Utils::SmallIcon(Icon_Utils::it_Public_Method), i18n("Operation..."));
insert(mt_Template, menu, Icon_Utils::SmallIcon(Icon_Utils::it_Template_New), i18n("Template..."));
insert(mt_Class, menu, Icon_Utils::SmallIcon(Icon_Utils::it_Class), i18nc("new class menu item", "Class..."));
insert(mt_Interface, menu, Icon_Utils::SmallIcon(Icon_Utils::it_Interface), i18n("Interface..."));
insert(mt_Datatype, menu, Icon_Utils::SmallIcon(Icon_Utils::it_Datatype), i18n("Datatype..."));
insert(mt_Enum, menu, Icon_Utils::SmallIcon(Icon_Utils::it_Enum), i18n("Enum..."));
addMenu(menu);
makeClassifierShowPopup(c);
......@@ -1440,12 +1444,21 @@ UMLObject::ObjectType ListPopupMenu::convert_MT_OT(MenuType mt)
case mt_Class:
type = UMLObject::ot_Class;
break;
case mt_Datatype:
type = UMLObject::ot_Datatype;
break;
case mt_Attribute:
type = UMLObject::ot_Attribute;
break;
case mt_Interface:
type = UMLObject::ot_Interface;
break;
case mt_Template:
type = UMLObject::ot_Template;
break;
case mt_Enum:
type = UMLObject::ot_Enum;
break;
case mt_EnumLiteral:
type = UMLObject::ot_EnumLiteral;
break;
......
......@@ -1350,6 +1350,27 @@ void ClassifierWidget::slotMenuSelection(QAction* action)
}
break;
}
case ListPopupMenu::mt_Class:
case ListPopupMenu::mt_Datatype:
case ListPopupMenu::mt_Enum:
case ListPopupMenu::mt_Interface:
{
UMLObject::ObjectType ot = ListPopupMenu::convert_MT_OT(sel);
UMLClassifier *umlc = classifier();
if (!umlc) {
uError() << "Internal error - classifier() returns NULL";
return;
}
umlScene()->setCreateObject(true);
if (Object_Factory::createUMLObject(ot, QString(), umlc)) {
updateGeometry();
update();
UMLApp::app()->document()->setModified();
}
break;
}
case ListPopupMenu::mt_Show_Operations:
toggleVisualProperty(ShowOperations);
break;
......
Markdown is supported
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