![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
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 |
![]() | |
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) |
![]() | |
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) |
|
explicit |
It is possible to retrieve an action for an index, and to call the action's slots from a given index.
|
static |
The method can also be used for indices from proxy models.
|
overridevirtual |
Reimplemented from Digikam::CategorizedItemModel.
|
slot |
Connect here for example a view's signals. Note that you can also pass indices from proxy models.
QStandardItem * Digikam::ActionItemModel::itemForAction | ( | QAction * | action | ) | const |
Note: these methods perform O(n).