void ClassifierWidget::slotMenuSelection(QAction* action) { ListPopupMenu::Menu_Type sel = m_pMenu->getMenuType(action); switch (sel) { case ListPopupMenu::mt_Attribute: case ListPopupMenu::mt_Operation: case ListPopupMenu::mt_Template: { Uml::Object_Type ot = ListPopupMenu::convert_MT_OT(sel); if (Object_Factory::createChildObject(classifier(), ot)) { updateComponentSize(); update(); UMLApp::app()->document()->setModified(); } break; } case ListPopupMenu::mt_Show_Operations: case ListPopupMenu::mt_Show_Operations_Selection: toggleShowOps(); break; case ListPopupMenu::mt_Show_Attributes: case ListPopupMenu::mt_Show_Attributes_Selection: toggleShowAtts(); break; case ListPopupMenu::mt_Show_Public_Only: case ListPopupMenu::mt_Show_Public_Only_Selection: toggleShowPublicOnly(); break; case ListPopupMenu::mt_Show_Operation_Signature: case ListPopupMenu::mt_Show_Operation_Signature_Selection: toggleShowOpSigs(); break; case ListPopupMenu::mt_Show_Attribute_Signature: case ListPopupMenu::mt_Show_Attribute_Signature_Selection: toggleShowAttSigs(); break; case ListPopupMenu::mt_Visibility: case ListPopupMenu::mt_Visibility_Selection: toggleShowVisibility(); break; case ListPopupMenu::mt_Show_Packages: case ListPopupMenu::mt_Show_Packages_Selection: toggleShowPackage(); break; case ListPopupMenu::mt_Show_Stereotypes: case ListPopupMenu::mt_Show_Stereotypes_Selection: toggleShowStereotype(); break; case ListPopupMenu::mt_DrawAsCircle: case ListPopupMenu::mt_DrawAsCircle_Selection: toggleDrawAsCircle(); break; case ListPopupMenu::mt_ChangeToClass: case ListPopupMenu::mt_ChangeToClass_Selection: changeToClass(); break; case ListPopupMenu::mt_ChangeToInterface: case ListPopupMenu::mt_ChangeToInterface_Selection: changeToInterface(); break; default: UMLWidget::slotMenuSelection(action); break; } }
/** * Will be called when a menu selection has been made from the * popup menu. * * @param action The action that has been selected. */ void ClassifierWidget::slotMenuSelection(QAction* action) { ListPopupMenu *menu = ListPopupMenu::menuFromAction(action); if (!menu) { uError() << "Action's data field does not contain ListPopupMenu pointer"; return; } ListPopupMenu::MenuType sel = menu->getMenuType(action); switch (sel) { case ListPopupMenu::mt_Attribute: case ListPopupMenu::mt_Operation: case ListPopupMenu::mt_Template: { UMLObject::ObjectType ot = ListPopupMenu::convert_MT_OT(sel); if (Object_Factory::createChildObject(classifier(), ot)) { UMLApp::app()->document()->setModified(); } break; } case ListPopupMenu::mt_Show_Operations: case ListPopupMenu::mt_Show_Operations_Selection: toggleVisualProperty(ShowOperations); break; case ListPopupMenu::mt_Show_Attributes: case ListPopupMenu::mt_Show_Attributes_Selection: toggleVisualProperty(ShowAttributes); break; case ListPopupMenu::mt_Show_Public_Only: case ListPopupMenu::mt_Show_Public_Only_Selection: toggleVisualProperty(ShowPublicOnly); break; case ListPopupMenu::mt_Show_Operation_Signature: case ListPopupMenu::mt_Show_Operation_Signature_Selection: toggleVisualProperty(ShowOperationSignature); break; case ListPopupMenu::mt_Show_Attribute_Signature: case ListPopupMenu::mt_Show_Attribute_Signature_Selection: toggleVisualProperty(ShowAttributeSignature); break; case ListPopupMenu::mt_Visibility: case ListPopupMenu::mt_Visibility_Selection: toggleVisualProperty(ShowVisibility); break; case ListPopupMenu::mt_Show_Packages: case ListPopupMenu::mt_Show_Packages_Selection: toggleVisualProperty(ShowPackage); break; case ListPopupMenu::mt_Show_Stereotypes: case ListPopupMenu::mt_Show_Stereotypes_Selection: toggleVisualProperty(ShowStereotype); break; case ListPopupMenu::mt_DrawAsCircle: case ListPopupMenu::mt_DrawAsCircle_Selection: toggleVisualProperty(DrawAsCircle); break; case ListPopupMenu::mt_ChangeToClass: case ListPopupMenu::mt_ChangeToClass_Selection: changeToClass(); break; case ListPopupMenu::mt_ChangeToInterface: case ListPopupMenu::mt_ChangeToInterface_Selection: changeToInterface(); break; default: UMLWidget::slotMenuSelection(action); break; } }