umbrello: ListPopupMenu Class Reference

umbrello 25.04.0 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ListPopupMenu Class Reference

Displays a popup menu. More...

`#include <listpopupmenu.h>`

Inheritance diagram for ListPopupMenu:

## Public Types
enum | MenuType { mt_Model , mt_Activity_Diagram , mt_Class_Diagram , mt_Collaboration_Diagram , mt_Component_Diagram , mt_Deployment_Diagram , mt_EntityRelationship_Diagram , mt_Sequence_Diagram , mt_State_Diagram , mt_UseCase_Diagram , mt_Logical_Folder , mt_UseCase_Folder , mt_Component_Folder , mt_Deployment_Folder , mt_EntityRelationship_Folder , mt_Accept_Signal , mt_Accept_Time_Event , mt_Activity , mt_Activity_Transition , mt_Actor , mt_Artifact , mt_Attribute , mt_Branch , mt_Category , mt_CheckConstraint , mt_Choice , mt_Class , mt_CombinedState , mt_Component , mt_Datatype , mt_DeepHistory , mt_DisjointSpecialisation , mt_EditCombinedState , mt_End_Activity , mt_End_State , mt_Entity , mt_EntityAttribute , mt_Enum , mt_EnumLiteral , mt_Exception , mt_FloatText , mt_Final_Activity , mt_ForeignKeyConstraint , mt_Fork , mt_GoToStateDiagram , mt_Initial_Activity , mt_Initial_State , mt_Invoke_Activity , mt_Instance , mt_InstanceAttribute , mt_Interface , mt_InterfaceComponent , mt_InterfaceProvided , mt_InterfaceRequired , mt_Junction , mt_MessageAsynchronous , mt_MessageCreation , mt_MessageDestroy , mt_MessageFound , mt_MessageLost , mt_MessageSynchronous , mt_Node , mt_Note , mt_Object , mt_Object_Node , mt_Operation , mt_OverlappingSpecialisation , mt_Package , mt_Param_Activity , mt_Pin , mt_Port , mt_PrePostCondition , mt_PrimaryKeyConstraint , mt_Region , mt_SelectStateDiagram , mt_Send_Signal , mt_ShallowHistory , mt_State , mt_StateFork , mt_StateJoin , mt_StateTransition , mt_Subsystem , mt_Template , mt_Union , mt_UniqueConstraint , mt_UseCase , mt_New_Activity , mt_New_Attribute , mt_New_EntityAttribute , mt_New_EnumLiteral , mt_New_InstanceAttribute , mt_New_Operation , mt_New_Parameter , mt_New_Template , mt_RemoveStateDiagram , mt_ReturnToClass , mt_ReturnToCombinedState , mt_Hide_Attribute_Signature_Selection , mt_Hide_Attributes_Selection , mt_Hide_Destruction_Box , mt_Hide_NonPublic_Selection , mt_Hide_Operation_Signature_Selection , mt_Hide_Operations_Selection , mt_Hide_Packages_Selection , mt_Hide_Stereotypes_Selection , mt_Hide_Visibility_Selection , mt_Show_Attribute_Signature , mt_Show_Attribute_Signature_Selection , mt_Show_Attributes_Selection , mt_Show_Attributes , mt_Show_Destruction_Box , mt_Show_Documentation , mt_Show_NonPublic_Selection , mt_Show_Operation_Signature , mt_Show_Operation_Signature_Selection , mt_Show_Operations_Selection , mt_Show_Operations , mt_Show_Packages , mt_Show_Packages_Selection , mt_Show_Public_Only , mt_Show_Stereotypes , mt_Show_Stereotypes_Selection , mt_Show_Visibility_Selection , mt_Visibility , mt_DrawAsCircle , mt_ChangeToClass , mt_ChangeToInterface , mt_ChangeToPackage , mt_Open_File , mt_Rename_Object , mt_Select_Operation , mt_Properties , mt_Rename , mt_NameAsTooltip , mt_Show , mt_Delete , mt_Export_Image , mt_Import_Class , mt_Import_Project , mt_Cut , mt_Copy , mt_Paste , mt_Clear , mt_Redo , mt_Undo , mt_Reset_Label_Positions , mt_Line_Color , mt_Line_Color_Selection , mt_Fill_Color , mt_Fill_Color_Selection , mt_Use_Fill_Color , mt_Set_Use_Fill_Color_Selection , mt_Unset_Use_Fill_Color_Selection , mt_Rename_MultiA , mt_Rename_MultiB , mt_Rename_Name , mt_Rename_RoleAName , mt_Rename_RoleBName , mt_Change_Font , mt_Change_Font_Selection , mt_SnapToGrid , mt_SnapComponentSizeToGrid , mt_ShowDocumentationIndicator , mt_ShowSnapGrid , mt_AutoResize , mt_Resize , mt_Up , mt_Down , mt_FlipHorizontal , mt_FlipVertical , mt_Add_Point , mt_Delete_Point , mt_Auto_Layout_Spline , mt_Expand_All , mt_Collapse_All , mt_Refactoring , mt_ViewCode , mt_Clone , mt_Externalize_Folder , mt_Internalize_Folder , mt_AddInteractionOperand , mt_Apply_Layout , mt_Apply_Layout1 , mt_Apply_Layout2 , mt_Apply_Layout3 , mt_Apply_Layout4 , mt_Apply_Layout5 , mt_Apply_Layout6 , mt_Apply_Layout7 , mt_Apply_Layout8 , mt_Apply_Layout9 , mt_LayoutDirect , mt_LayoutSpline , mt_LayoutOrthogonal , mt_LayoutPolyline , mt_Align_Right , mt_Align_Left , mt_Align_Top , mt_Align_Bottom , mt_Align_VerticalMiddle , mt_Align_HorizontalMiddle , mt_Align_VerticalDistribute , mt_Align_HorizontalDistribute , mt_Import_from_File , mt_Remove , mt_Undefined = - 1 }
| < This type hosts all possible menu entry types More...
enum | DataType { dt_MenuPointer , dt_ApplyLayout }
| < Key value of the data map used in actions. More...

## Public Member Functions
| ListPopupMenu (QWidget *parent=nullptr)
virtual | ~ListPopupMenu ()
QAction * | getAction (MenuType idx)
void | setActionEnabled (MenuType idx, bool value)
MenuType | getMenuType (QAction *action)
void | dumpActions (const QString &title)
QMenu * | newMenu (const QString &title, QWidget *widget)
void | addMenu (QMenu *menu)

## Static Public Member Functions
static QString | toString (MenuType menu)
static QString | toString (DataType data)
static QVariant | dataFromAction (DataType key, QAction *action)
static UMLObject::ObjectType | convert_MT_OT (MenuType mt)
static ListPopupMenu * | menuFromAction (QAction *action)
static MenuType | typeFromAction (QAction *action)

## Protected Member Functions
void | insert (MenuType m)
void | insertFromActionKey (const MenuType m, QMenu *menu, const QString &action)
void | insert (const MenuType m, QMenu *menu)
void | insert (const MenuType m, QMenu *menu, const QIcon &icon, const QString &text)
void | insert (const MenuType m, QMenu *menu, const QString &text, const bool checkable=false)
void | insert (const MenuType m, const QIcon &icon, const QString &text)
void | insert (const MenuType m, const QString &text, const bool checkable=false)
void | insertContainerItems (bool folders, bool diagrams, bool packages)
void | insertContainerItems (QMenu *menu, bool folders, bool diagrams, bool packages)
void | insertAssociationTextItem (const QString &label, MenuType mt)
QMenu * | makeNewMenu ()
void | insertSubMenuCategoryType (UMLCategory *category)
void | setActionChecked (MenuType idx, bool value)
void | setupActionsData ()

## Protected Attributes
QHash< MenuType, QAction * > | m_actions
ListPopupMenuPrivate * | d

## Detailed Description

Displays a popup menu.

A popup menu that depending on what type is set to will display a different menu.

The data field of actions is used to carry user data between objects. Because different types of data are used, a map is loaded with an enum as key (see DataType).

Author
  Paul Hensgen phens.nosp@m.gen@.nosp@m.techi.nosp@m.e.co.nosp@m.m Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org

## Member Enumeration Documentation

## ◆ DataType

enum ListPopupMenu::DataType

< Key value of the data map used in actions.

Enumerator
dt_MenuPointer |
dt_ApplyLayout |

## ◆ MenuType

enum ListPopupMenu::MenuType

< This type hosts all possible menu entry types

Enumerator
mt_Model |
mt_Activity_Diagram |
mt_Class_Diagram |
mt_Collaboration_Diagram |
mt_Component_Diagram |
mt_Deployment_Diagram |
mt_EntityRelationship_Diagram |
mt_Sequence_Diagram |
mt_State_Diagram |
mt_UseCase_Diagram |
mt_Logical_Folder |
mt_UseCase_Folder |
mt_Component_Folder |
mt_Deployment_Folder |
mt_EntityRelationship_Folder |
mt_Accept_Signal |
mt_Accept_Time_Event |
mt_Activity |
mt_Activity_Transition |
mt_Actor |
mt_Artifact |
mt_Attribute |
mt_Branch |
mt_Category |
mt_CheckConstraint |
mt_Choice |
mt_Class |
mt_CombinedState |
mt_Component |
mt_Datatype |
mt_DeepHistory |
mt_DisjointSpecialisation |
mt_EditCombinedState |
mt_End_Activity |
mt_End_State |
mt_Entity |
mt_EntityAttribute |
mt_Enum |
mt_EnumLiteral |
mt_Exception |
mt_FloatText |
mt_Final_Activity |
mt_ForeignKeyConstraint |
mt_Fork |
mt_GoToStateDiagram |
mt_Initial_Activity |
mt_Initial_State |
mt_Invoke_Activity |
mt_Instance |
mt_InstanceAttribute |
mt_Interface |
mt_InterfaceComponent |
mt_InterfaceProvided |
mt_InterfaceRequired |
mt_Junction |
mt_MessageAsynchronous |
mt_MessageCreation |
mt_MessageDestroy |
mt_MessageFound |
mt_MessageLost |
mt_MessageSynchronous |
mt_Node |
mt_Note |
mt_Object |
mt_Object_Node |
mt_Operation |
mt_OverlappingSpecialisation |
mt_Package |
mt_Param_Activity |
mt_Pin |
mt_Port |
mt_PrePostCondition |
mt_PrimaryKeyConstraint |
mt_Region |
mt_SelectStateDiagram |
mt_Send_Signal |
mt_ShallowHistory |
mt_State |
mt_StateFork |
mt_StateJoin |
mt_StateTransition |
mt_Subsystem |
mt_Template |
mt_Union |
mt_UniqueConstraint |
mt_UseCase |
mt_New_Activity |
mt_New_Attribute |
mt_New_EntityAttribute |
mt_New_EnumLiteral |
mt_New_InstanceAttribute |
mt_New_Operation |
mt_New_Parameter |
mt_New_Template |
mt_RemoveStateDiagram |
mt_ReturnToClass |
mt_ReturnToCombinedState |
mt_Hide_Attribute_Signature_Selection |
mt_Hide_Attributes_Selection |
mt_Hide_Destruction_Box |
mt_Hide_NonPublic_Selection |
mt_Hide_Operation_Signature_Selection |
mt_Hide_Operations_Selection |
mt_Hide_Packages_Selection |
mt_Hide_Stereotypes_Selection |
mt_Hide_Visibility_Selection |
mt_Show_Attribute_Signature |
mt_Show_Attribute_Signature_Selection |
mt_Show_Attributes_Selection |
mt_Show_Attributes |
mt_Show_Destruction_Box |
mt_Show_Documentation |
mt_Show_NonPublic_Selection |
mt_Show_Operation_Signature |
mt_Show_Operation_Signature_Selection |
mt_Show_Operations_Selection |
mt_Show_Operations |
mt_Show_Packages |
mt_Show_Packages_Selection |
mt_Show_Public_Only |
mt_Show_Stereotypes |
mt_Show_Stereotypes_Selection |
mt_Show_Visibility_Selection |
mt_Visibility |
mt_DrawAsCircle |
mt_ChangeToClass |
mt_ChangeToInterface |
mt_ChangeToPackage |
mt_Open_File |
mt_Rename_Object |
mt_Select_Operation |
mt_Properties |
mt_Rename |
mt_NameAsTooltip |
mt_Show |
mt_Delete |
mt_Export_Image |
mt_Import_Class |
mt_Import_Project |
mt_Cut |
mt_Copy |
mt_Paste |
mt_Clear |
mt_Redo |
mt_Undo |
mt_Reset_Label_Positions |
mt_Line_Color |
mt_Line_Color_Selection |
mt_Fill_Color |
mt_Fill_Color_Selection |
mt_Use_Fill_Color |
mt_Set_Use_Fill_Color_Selection |
mt_Unset_Use_Fill_Color_Selection |
mt_Rename_MultiA |
mt_Rename_MultiB |
mt_Rename_Name |
mt_Rename_RoleAName |
mt_Rename_RoleBName |
mt_Change_Font |
mt_Change_Font_Selection |
mt_SnapToGrid |
mt_SnapComponentSizeToGrid |
mt_ShowDocumentationIndicator |
mt_ShowSnapGrid |
mt_AutoResize |
mt_Resize |
mt_Up |
mt_Down |
mt_FlipHorizontal |
mt_FlipVertical |
mt_Add_Point |
mt_Delete_Point |
mt_Auto_Layout_Spline |
mt_Expand_All |
mt_Collapse_All |
mt_Refactoring |
mt_ViewCode |
mt_Clone |
mt_Externalize_Folder |
mt_Internalize_Folder |
mt_AddInteractionOperand |
mt_Apply_Layout |
mt_Apply_Layout1 |
mt_Apply_Layout2 |
mt_Apply_Layout3 |
mt_Apply_Layout4 |
mt_Apply_Layout5 |
mt_Apply_Layout6 |
mt_Apply_Layout7 |
mt_Apply_Layout8 |
mt_Apply_Layout9 |
mt_LayoutDirect |
mt_LayoutSpline |
mt_LayoutOrthogonal |
mt_LayoutPolyline |
mt_Align_Right |
mt_Align_Left |
mt_Align_Top |
mt_Align_Bottom |
mt_Align_VerticalMiddle |
mt_Align_HorizontalMiddle |
mt_Align_VerticalDistribute |
mt_Align_HorizontalDistribute |
mt_Import_from_File |
mt_Remove |
mt_Undefined |

## Constructor & Destructor Documentation

## ◆ ListPopupMenu()

ListPopupMenu::ListPopupMenu | ( | QWidget * | parent = nullptr | ) |

Constructs the popup menu

Parameters

  parent | The parent to ListPopupMenu.

## ◆ ~ListPopupMenu()

ListPopupMenu::~ListPopupMenu | ( |  | ) |
| virtual

Standard destructor.

## Member Function Documentation

## ◆ addMenu()

void ListPopupMenu::addMenu | ( | QMenu * | menu | ) |

## ◆ convert_MT_OT()

UMLObject::ObjectType ListPopupMenu::convert_MT_OT | ( | MenuType | mt | ) |
| static

Utility: Convert a MenuType value to an ObjectType value.

## ◆ dataFromAction()

QVariant ListPopupMenu::dataFromAction | ( | DataType | key,
|  | QAction * | action )
| static

Returns the data from the given action to the given key.

## ◆ dumpActions()

void ListPopupMenu::dumpActions | ( | const QString & | title | ) |

dump collected actions

Parameters

  title | optional menu title

## ◆ getAction()

QAction * ListPopupMenu::getAction | ( | MenuType | idx | ) |

Get the action from the menu type as index.

## ◆ getMenuType()

ListPopupMenu::MenuType ListPopupMenu::getMenuType | ( | QAction * | action | ) |

Get the MenuType from the action.

Get the MenuType from the action.

## ◆ insert() [1/6]

void ListPopupMenu::insert | ( | const MenuType | m,
|  | const QIcon & | icon,
|  | const QString & | text )
| protected

Shortcut for the frequently used addAction() calls.

Parameters

  m | The MenuType for which to insert a menu item.
  icon | The icon for this action.
  text | The text for this action.

## ◆ insert() [2/6]

void ListPopupMenu::insert | ( | const MenuType | m,
|  | const QString & | text,
|  | const bool | checkable = false )
| protected

Shortcut for the frequently used addAction() calls.

Parameters

  m | The MenuType for which to insert a menu item.
  text | The text for this action.
  checkable | Sets the action to checkable.

## ◆ insert() [3/6]

void ListPopupMenu::insert | ( | const MenuType | m,
|  | QMenu * | menu )
| protected

Shortcut for the frequently used addAction() calls.

Parameters

  m | The MenuType for which to insert a menu item.
  menu | The QMenu for which to insert a menu item.

## ◆ insert() [4/6]

void ListPopupMenu::insert | ( | const MenuType | m,
|  | QMenu * | menu,
|  | const QIcon & | icon,
|  | const QString & | text )
| protected

Shortcut for the frequently used addAction() calls.

Parameters

  m | The MenuType for which to insert a menu item.
  menu | The QMenu for which to insert a menu item.
  icon | The icon for this action.
  text | The text for this action.

## ◆ insert() [5/6]

void ListPopupMenu::insert | ( | const MenuType | m,
|  | QMenu * | menu,
|  | const QString & | text,
|  | const bool | checkable = false )
| protected

Shortcut for the frequently used addAction() calls.

Parameters

  m | The MenuType for which to insert a menu item.
  menu | The QMenu for which to insert a menu item.
  text | The text for this action.
  checkable | Sets the action to checkable.

## ◆ insert() [6/6]

void ListPopupMenu::insert | ( | MenuType | m | ) |
| protected

Shortcut for the frequently used addAction() calls.

Parameters

  m | The MenuType for which to insert a menu item.

## ◆ insertAssociationTextItem()

void ListPopupMenu::insertAssociationTextItem | ( | const QString & | label,
|  | MenuType | mt )
| protected

Inserts a menu item for an association related text (such as name, role, multiplicity etc.)

Parameters

  label | The menu text.
  mt | The menu type.

## ◆ insertContainerItems() [1/2]

void ListPopupMenu::insertContainerItems | ( | bool | folders,
|  | bool | diagrams,
|  | bool | packages )
| protected

Shortcut for inserting standard model items (Class, Interface, Datatype, Enum, Package) as well as diagram choices.

Parameters

  folders | Set this true if folders shall be included as choices.
  diagrams | Set this true if diagram types shall be included as choices.
  packages | Set this true if packages shall be included as choices.

## ◆ insertContainerItems() [2/2]

void ListPopupMenu::insertContainerItems | ( | QMenu * | menu,
|  | bool | folders,
|  | bool | diagrams,
|  | bool | packages )
| protected

Shortcut for inserting standard model items (Class, Interface, Datatype, Enum, Package) as well as diagram choices.

Parameters

  menu | Menu to add the menu entries
  folders | Set this true if folders shall be included as choices.
  diagrams | Set this true if diagram types shall be included as choices.
  packages | Set this true if packages shall be included as choices.

## ◆ insertFromActionKey()

void ListPopupMenu::insertFromActionKey | ( | const MenuType | m,
|  | QMenu * | menu,
|  | const QString & | s )
| protected

Shortcut for the frequently used addAction() calls.

Parameters

  m | The MenuType for which to insert a menu item.
  menu | The QMenu for which to insert a menu item.
  s | The entry to be inserted from the action collection

## ◆ insertSubMenuCategoryType()

void ListPopupMenu::insertSubMenuCategoryType | ( | UMLCategory * | category | ) |
| protected

Creates a popup menu for a single category Object

Parameters

  category | The UMLCategory for which the category menu is created

## ◆ makeNewMenu()

QMenu * ListPopupMenu::makeNewMenu | ( |  | ) |
| protected

Create the 'new' menu

Returns
  menu instance

## ◆ menuFromAction()

ListPopupMenu * ListPopupMenu::menuFromAction | ( | QAction * | action | ) |
| static

Convenience method to extract the ListPopupMenu pointer stored in QAction objects belonging to ListPopupMenu.

## ◆ newMenu()

QMenu * ListPopupMenu::newMenu | ( | const QString & | title,
|  | QWidget * | widget )

## ◆ setActionChecked()

void ListPopupMenu::setActionChecked | ( | MenuType | idx,
|  | bool | value )
| protected

Checks the action item.

Parameters

  idx | The MenuType for which to check the menu item.
  value | The value.

## ◆ setActionEnabled()

void ListPopupMenu::setActionEnabled | ( | MenuType | idx,
|  | bool | value )

Enables the action item.

Parameters

  idx | The MenuType for which to enable the menu item.
  value | The value.

## ◆ setupActionsData()

void ListPopupMenu::setupActionsData | ( |  | ) |
| protected

Sets up actions added to the ListPopupMenu to have their data field set to pointer to this ListPopupMenu object, so that this menu pointer can be retrieved in UMLWidget::slotMenuSelection

Note
  This might seem like an ugly hack, but this is the only solution which helped in avoiding storage of ListPopupMenu pointer in each UMLWidget.

## ◆ toString() [1/2]

QString ListPopupMenu::toString | ( | DataType | data | ) |
| static

Convert enum DataType to string.

## ◆ toString() [2/2]

QString ListPopupMenu::toString | ( | MenuType | menu | ) |
| static

Convert enum MenuType to string.

## ◆ typeFromAction()

ListPopupMenu::MenuType ListPopupMenu::typeFromAction | ( | QAction * | action | ) |
| static

Convenience method to extract the ListPopupMenu type from an action.

Parameters

  action | the action which was called

Returns
  menu type enum value

## Member Data Documentation

## ◆ d

ListPopupMenuPrivate* ListPopupMenu::d
| protected

## ◆ m_actions

QHash<MenuType, QAction*> ListPopupMenu::m_actions
| protected

The documentation for this class was generated from the following files:

- umbrello/menus/listpopupmenu.h
- umbrello/menus/listpopupmenu.cpp