digiKam Developer Documentation: Digikam::ImportContextMenuHelper Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | List of all members
Digikam::ImportContextMenuHelper Class Reference
Inheritance diagram for Digikam::ImportContextMenuHelper:

## Public Types
typedef const QList< qlonglong > | itemIds

## Signals
void | signalAddNewTagFromABCMenu (const QString &)
void | signalAssignColorLabel (int)
void | signalAssignPickLabel (int)
void | signalAssignRating (int)

## Public Member Functions
| ImportContextMenuHelper (QMenu *const parent, KActionCollection *const actionCollection=nullptr)
| Constructs the helper class.
void | addAction (const QString &name, bool addDisabled=false)
| Add an action from the actionCollection.
void | addAction (QAction *action, bool addDisabled=false)
| Add a temporary action.
void | addAction (QAction *action, QObject *recv, const char *slot, bool addDisabled=false)
| Add a temporary action and assign it to a custom slot.
void | addAssignTagsMenu (itemIds &ids)
| Add actions to add, remove or edit a tag.
void | addGroupActions (itemIds &ids)
void | addGroupMenu (itemIds &ids)
| Add a "Group" menu.
void | addLabelsAction ()
| Add "Pick/Color/Rating Labels" action.
void | addRemoveTagsMenu (itemIds &ids)
| Add "Remove Tags" menu.
void | addRotateMenu (itemIds &ids)
| Add a menu to rotate item.
void | addSeparator ()
| Add a separator to the context menu.
void | addServicesMenu (const QList< QUrl > &selectedItems)
| Add the services menu to the menu.
void | addSubMenu (QMenu *subMenu)
| Add a submenu to the parent context menu.
QAction * | exec (const QPoint &pos, QAction *at=nullptr)
| Execute the registered parent menu and evaluate the triggered actions.
void | setImportFilterModel (ImportFilterModel *model)
| Set a filter model.

## Constructor & Destructor Documentation

## ◆ ImportContextMenuHelper()

Digikam::ImportContextMenuHelper::ImportContextMenuHelper | ( | QMenu *const | parent,
|  | KActionCollection *const | actionCollection = `nullptr`
| ) |  |
| explicit

Parameters

  parent | the menu the helper class is linked to
  actionCollection | the actionCollection that should be used. If not set, the standard action from DigikamApp is used

## Member Function Documentation

## ◆ addAction() [1/3]

void Digikam::ImportContextMenuHelper::addAction | ( | const QString & | name,
|  | bool | addDisabled = `false`
| ) |  |

This method adds actions from the actionCollection. The actionCollection can be set in the constructor of the ImportContextMenuHelper class.

Parameters

  name | the name of the action in the actionCollection
  addDisabled | if set, disabled actions are added to the menu

## ◆ addAction() [2/3]

void Digikam::ImportContextMenuHelper::addAction | ( | QAction * | action,
|  | bool | addDisabled = `false`
| ) |  |

Sometimes it is necessary to define actions that only exist in the current context menu content. Use this method to add such an action.

Parameters

  action | the action to add
  addDisabled | if set, disabled actions are added to the menu

## ◆ addAction() [3/3]

void Digikam::ImportContextMenuHelper::addAction | ( | QAction * | action,
|  | QObject * | recv,
|  | const char * | slot,
|  | bool | addDisabled = `false`
| ) |  |

Use this method if you want to add a temporary action and immediately connect it to the receiving slot.

Parameters

  action | the action to add
  recv | the receiver of the triggered action
  slot | the slot to connect the triggered action to
  addDisabled | if set, disabled actions are added to the menu

## ◆ addAssignTagsMenu()

void Digikam::ImportContextMenuHelper::addAssignTagsMenu | ( | itemIds & | ids | ) |

The tag modification helper is used to execute the action. You must set the parent tag to use on modification helper. Add "Assign Tags" menu.

This menu will provide a list of all tags available so that they can be assigned to the current selected items.

To make this menu work, you need to run exec() from this class, otherwise the signals are not emitted and you will not be able to react on triggered actions from this menu. Make sure to connect the signals to the appropriate slots in the context menu handling method.

Parameters

  ids | the selected items

See also
  exec()
  signalAssignTag()

## ◆ addGroupMenu()

void Digikam::ImportContextMenuHelper::addGroupMenu | ( | itemIds & | ids | ) |

This menu will provide actions open, close, add to, remove from, or split a group.

addGroupActions will add the actions as a flat list, not in a submenu. Note: Call setItemFilterModel before to have Open/Close group actions.

## ◆ addLabelsAction()

void Digikam::ImportContextMenuHelper::addLabelsAction | ( |  | ) |

This action will provide methods to assign pick/color/rating labels to the currently selected items.

To make this menu work, you need to run exec() from this class, otherwise the signals are not emitted and you will not be able to react on triggered actions from this menu. Make sure to connect the signals to the appropriate slots in the context menu handling method.

See also
  exec()
  signalAssignPickLabel()
  signalAssignColorLabel()
  signalAssignRating()

## ◆ addRemoveTagsMenu()

void Digikam::ImportContextMenuHelper::addRemoveTagsMenu | ( | itemIds & | ids | ) |

This menu will provide a list of all tags assigned to the current items. Actions triggered in here will remove the selected tag from the items.

To make this menu work, you need to run exec() from this class, otherwise the signals are not emitted and you will not be able to react on triggered actions from this menu. Make sure to connect the signals to the appropriate slots in the context menu handling method.

Parameters

  ids | the selected items

See also
  exec()
  signalRemoveTag()

## ◆ addRotateMenu()

void Digikam::ImportContextMenuHelper::addRotateMenu | ( | itemIds & | ids | ) |

Parameters

  ids | the selected items

## ◆ addServicesMenu()

void Digikam::ImportContextMenuHelper::addServicesMenu | ( | const QList< QUrl > & | selectedItems | ) |

The services menu is used to open the selected items in a different application. It will query the item for registered services and provide them in a submenu. The menu will be titled "Open With...".

Parameters

  selectedItems | the list of selected items

## ◆ addSubMenu()

void Digikam::ImportContextMenuHelper::addSubMenu | ( | QMenu * | subMenu | ) |

Parameters

  subMenu | the submenu to be added

## ◆ exec()

QAction * Digikam::ImportContextMenuHelper::exec | ( | const QPoint & | pos,
|  | QAction * | at = `nullptr`
| ) |  |

Always use this method instead the one from the parent menu. It will ensure that the signals are emitted and special cases are handled.

Parameters

  pos | position of the triggered action in the registered menu
  at | the action that should be at the position pos

Returns
  the triggered action

## ◆ setImportFilterModel()

void Digikam::ImportContextMenuHelper::setImportFilterModel | ( | ImportFilterModel * | model | ) |

Some of the group actions will operate directly on the model.