NDEVR
API Documentation
ModelTableDelegate

A QItemDelegate for showing model properties in a QTableView. More...

Collaboration diagram for ModelTableDelegate:
[legend]

Public Member Functions

 ModelTableDelegate (DesignSortFilterProxyModel *model, QObject *parent=nullptr)
 Constructs a ModelTableDelegate for the given proxy model.
bool editorEvent (QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
 Handles editor events such as clicks on material cells.
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 Paints a cell in the table, including custom rendering for material properties.
void setModel (DesignSortFilterProxyModel *model)
 Sets the proxy model used by this delegate.

Protected Attributes

MaterialWidgetm_click_material_widget
 Reusable widget for handling material cell clicks.
MaterialWidgetm_draw_material_widget
 Reusable widget for painting material cells.
DesignSortFilterProxyModelm_table_model
 The proxy model providing data for this delegate.

Detailed Description

A QItemDelegate for showing model properties in a QTableView.


Definition at line 51 of file DesignPropertyTable.h.

Constructor & Destructor Documentation

◆ ModelTableDelegate()

ModelTableDelegate::ModelTableDelegate ( DesignSortFilterProxyModel * model,
QObject * parent = nullptr )
explicit

Constructs a ModelTableDelegate for the given proxy model.

Parameters
[in]modelThe sort/filter proxy model providing data.
[in]parentThe parent QObject.

Member Function Documentation

◆ editorEvent()

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

Handles editor events such as clicks on material cells.

Parameters
[in]eventThe event to process.
[in]modelThe abstract item model.
[in]optionThe style options for the item.
[in]indexThe model index of the item.
Returns
True if the event was handled.

◆ paint()

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

Paints a cell in the table, including custom rendering for material properties.

Parameters
[in]painterThe QPainter to use for rendering.
[in]optionThe style options for the item.
[in]indexThe model index of the item to paint.

◆ setModel()

void ModelTableDelegate::setModel ( DesignSortFilterProxyModel * model)
inline

Sets the proxy model used by this delegate.

Parameters
[in]modelThe sort/filter proxy model.

Definition at line 81 of file DesignPropertyTable.h.

References m_table_model.


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