digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::ActionItemModel Class Reference
Inheritance diagram for Digikam::ActionItemModel:

Public Types

enum  ExtraRoles { ItemActionRole = Qt::UserRole + 10 }
enum  MenuCategoryFlag { ToplevelMenuCategory = 1 << 0 , ParentMenuCategory = 1 << 1 , SortCategoriesAlphabetically = 1 << 10 , SortCategoriesByInsertionOrder = 1 << 11 }
typedef QFlags< MenuCategoryFlag > MenuCategoryMode
Public Types inherited from Digikam::CategorizedItemModel
enum  ExtraRoles { ItemOrderRole = Qt::UserRole + 1 }

Public Slots

void hover (const QModelIndex &index)
 These three slots will cause the slots of the referred action to be called.
void toggle (const QModelIndex &index)
void trigger (const QModelIndex &index)

Public Member Functions

 ActionItemModel (QObject *const parent=nullptr)
 This class is a CategorizedItemModel based on QActions, taking an action's text and icon for display and decoration.
QStandardItem * addAction (QAction *action, const QString &category, const QVariant &categorySorting=QVariant())
void addActions (QWidget *widget)
void addActions (QWidget *widget, const QList< QAction * > &actionWhiteList)
DCategorizedSortFilterProxyModel * createFilterModel () override
QModelIndex indexForAction (QAction *action) const
QStandardItem * itemForAction (QAction *action) const
 Returns the action for the given index.
MenuCategoryMode mode () const
void setMode (MenuCategoryMode mode)
Public Member Functions inherited from Digikam::CategorizedItemModel
 CategorizedItemModel (QObject *const parent=nullptr)
QStandardItem * addItem (const QString &text, const QIcon &decoration, const QVariant &category, const QVariant &categorySorting=QVariant())
QStandardItem * addItem (const QString &text, const QVariant &category, const QVariant &categorySorting=QVariant())

Static Public Member Functions

static QAction * actionForIndex (const QModelIndex &index)
 Returns the action for the given index.

Protected Slots

void slotActionChanged ()

Protected Member Functions

void setPropertiesFromAction (QStandardItem *item, QAction *action)

Protected Attributes

DCategorizedSortFilterProxyModel * m_filterModel = nullptr
MenuCategoryMode m_mode = MenuCategoryMode(ToplevelMenuCategory | SortCategoriesAlphabetically)

Member Enumeration Documentation

◆ MenuCategoryFlag

Enumerator
ToplevelMenuCategory 

The toplevel menu's text is used as category.

ParentMenuCategory 

If the action is in a submenu, this menu's text is taken as category.

SortCategoriesAlphabetically 

Sort categories alphabetically by category name.

SortCategoriesByInsertionOrder 

Sort categories by the order they are added (found in the scanned menu).

Constructor & Destructor Documentation

◆ ActionItemModel()

Digikam::ActionItemModel::ActionItemModel ( QObject *const parent = nullptr)
explicit

It is possible to retrieve an action for an index, and to call the action's slots from a given index.

Member Function Documentation

◆ actionForIndex()

QAction * Digikam::ActionItemModel::actionForIndex ( const QModelIndex & index)
static

The method can also be used for indices from proxy models.

◆ createFilterModel()

DCategorizedSortFilterProxyModel * Digikam::ActionItemModel::createFilterModel ( )
overridevirtual

Reimplemented from Digikam::CategorizedItemModel.

◆ hover

void Digikam::ActionItemModel::hover ( const QModelIndex & index)
slot

Connect here for example a view's signals. Note that you can also pass indices from proxy models.

◆ itemForAction()

QStandardItem * Digikam::ActionItemModel::itemForAction ( QAction * action) const

Note: these methods perform O(n).