digiKam
Digikam::SetupCollectionDelegate Class Reference
+ Inheritance diagram for Digikam::SetupCollectionDelegate:

Signals

void categoryButtonPressed (int mappedId) const
 
void deletePressed (int mappedId) const
 
void updatePressed (int mappedId) const
 

Public Member Functions

QWidget * createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
QList< QWidget * > createItemWidgets (const QModelIndex &index) const override
 
bool editorEvent (QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
 
QPersistentModelIndex focusedIndex () const
 
QAbstractItemView * itemView () const
 
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
void setEditorData (QWidget *editor, const QModelIndex &index) const override
 
void setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
 
 SetupCollectionDelegate (QAbstractItemView *const view, QObject *const parent=nullptr)
 
QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
void updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
void updateItemWidgets (const QList< QWidget * > &widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const override
 
 ~SetupCollectionDelegate () override
 

Protected Member Functions

QList< QEvent::Type > blockedEventTypes (QWidget *const widget) const
 
void setBlockedEventTypes (QWidget *const widget, const QList< QEvent::Type > &types) const
 

Protected Attributes

int m_categoryMaxStyledWidth
 
QToolButton * m_sampleDeleteButton
 
QPushButton * m_samplePushButton
 
QToolButton * m_sampleUpdateButton
 
QStyledItemDelegate * m_styledDelegate
 

Constructor & Destructor Documentation

◆ SetupCollectionDelegate()

Digikam::SetupCollectionDelegate::SetupCollectionDelegate ( QAbstractItemView *const  view,
QObject *const  parent = nullptr 
)
explicit

◆ ~SetupCollectionDelegate()

Digikam::SetupCollectionDelegate::~SetupCollectionDelegate ( )
override

Member Function Documentation

◆ blockedEventTypes()

QList< QEvent::Type > Digikam::DWItemDelegate::blockedEventTypes ( QWidget *const  widget) const
protectedinherited

Retrieves the list of blocked event types for the given widget.

Parameters
widgetthe specified widget.
Returns
the list of blocked event types, can be empty if no events are blocked.

◆ categoryButtonPressed

void Digikam::SetupCollectionDelegate::categoryButtonPressed ( int  mappedId) const
signal

Referenced by createItemWidgets().

◆ createEditor()

QWidget * Digikam::SetupCollectionDelegate::createEditor ( QWidget *  parent,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
override

References m_styledDelegate.

◆ createItemWidgets()

QList< QWidget * > Digikam::SetupCollectionDelegate::createItemWidgets ( const QModelIndex &  index) const
overridevirtual

Creates the list of widgets needed for an item.

Note
No initialization of the widgets is supposed to happen here. The widgets will be initialized based on needs for a given item.
If you want to connect some widget signals to any slot, you should do it here.
  • index the index to create widgets for.
Note
If you want to know the index for which you are creating widgets, it is available as a QModelIndex Q_PROPERTY called "goya:creatingWidgetsForIndex". Ensure to add Q_DECLARE_METATYPE(QModelIndex) before your method definition to tell QVariant about QModelIndex.
Returns
the list of newly created widgets which will be used to interact with an item.
See also
updateItemWidgets()

Implements Digikam::DWItemDelegate.

References categoryButtonPressed(), deletePressed(), and updatePressed().

◆ deletePressed

void Digikam::SetupCollectionDelegate::deletePressed ( int  mappedId) const
signal

Referenced by createItemWidgets().

◆ editorEvent()

bool Digikam::SetupCollectionDelegate::editorEvent ( QEvent *  event,
QAbstractItemModel *  model,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
)
override

References m_styledDelegate.

◆ focusedIndex()

QPersistentModelIndex Digikam::DWItemDelegate::focusedIndex ( ) const
inherited

Retrieves the currently focused index. An invalid index if none is focused.

Returns
the current focused index, or QPersistentModelIndex() if none is focused.

References Digikam::DWItemDelegatePrivate::itemView, Digikam::DWItemDelegatePoolPrivate::widgetInIndex, and Digikam::DWItemDelegatePrivate::widgetPool.

◆ itemView()

QAbstractItemView * Digikam::DWItemDelegate::itemView ( ) const
inherited

Retrieves the item view this delegate is monitoring.

Returns
the item view this delegate is monitoring

References Digikam::DWItemDelegatePrivate::itemView.

Referenced by Digikam::DWItemDelegate::DWItemDelegate(), and updateItemWidgets().

◆ paint()

void Digikam::SetupCollectionDelegate::paint ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
override

References m_styledDelegate.

◆ setBlockedEventTypes()

void Digikam::DWItemDelegate::setBlockedEventTypes ( QWidget *const  widget,
const QList< QEvent::Type > &  types 
) const
protectedinherited

Sets the list of event types that a widget will block.

Blocked events are not passed to the view. This way you can prevent an item from being selected when a button is clicked for instance.

Parameters
widgetthe widget which must block events
typesthe list of event types the widget must block

◆ setEditorData()

void Digikam::SetupCollectionDelegate::setEditorData ( QWidget *  editor,
const QModelIndex &  index 
) const
override

References m_styledDelegate.

◆ setModelData()

void Digikam::SetupCollectionDelegate::setModelData ( QWidget *  editor,
QAbstractItemModel *  model,
const QModelIndex &  index 
) const
override

References m_styledDelegate.

◆ sizeHint()

◆ updateEditorGeometry()

void Digikam::SetupCollectionDelegate::updateEditorGeometry ( QWidget *  editor,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
override

References m_styledDelegate.

◆ updateItemWidgets()

void Digikam::SetupCollectionDelegate::updateItemWidgets ( const QList< QWidget * > &  widgets,
const QStyleOptionViewItem &  option,
const QPersistentModelIndex &  index 
) const
overridevirtual

Updates a list of widgets for its use inside of the delegate (painting or event handling).

Note
All the positioning and sizing should be done in item coordinates.
Warning
Do not make widget connections in here, since this method will be called very regularly.
Parameters
widgetsthe widgets to update
optionthe current set of style options for the view.
indexthe model index of the item currently manipulated.

Implements Digikam::DWItemDelegate.

References Digikam::SetupCollectionModel::CategoryButtonDisplayRole, Digikam::SetupCollectionModel::CategoryButtonMapId, Digikam::SetupCollectionModel::DeleteDecorationRole, Digikam::SetupCollectionModel::DeleteMapId, Digikam::SetupCollectionModel::IsCategoryRole, Digikam::SetupCollectionModel::IsDeleteRole, Digikam::SetupCollectionModel::IsUpdateRole, Digikam::DWItemDelegate::itemView(), m_categoryMaxStyledWidth, Digikam::SetupCollectionModel::UpdateDecorationRole, and Digikam::SetupCollectionModel::UpdateMapId.

◆ updatePressed

void Digikam::SetupCollectionDelegate::updatePressed ( int  mappedId) const
signal

Referenced by createItemWidgets().

Member Data Documentation

◆ m_categoryMaxStyledWidth

int Digikam::SetupCollectionDelegate::m_categoryMaxStyledWidth
protected

Referenced by sizeHint(), and updateItemWidgets().

◆ m_sampleDeleteButton

QToolButton* Digikam::SetupCollectionDelegate::m_sampleDeleteButton
protected

◆ m_samplePushButton

QPushButton* Digikam::SetupCollectionDelegate::m_samplePushButton
protected

◆ m_sampleUpdateButton

QToolButton* Digikam::SetupCollectionDelegate::m_sampleUpdateButton
protected

◆ m_styledDelegate

QStyledItemDelegate* Digikam::SetupCollectionDelegate::m_styledDelegate
protected

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