15 #ifndef BORNAGAIN_MVVM_VIEWMODEL_MVVM_VIEWMODEL_VIEWMODELDELEGATE_H
16 #define BORNAGAIN_MVVM_VIEWMODEL_MVVM_VIEWMODEL_VIEWMODELDELEGATE_H
18 #include "mvvm/viewmodel_export.h"
19 #include <QStyledItemDelegate>
24 class EditorFactoryInterface;
25 class CellDecoratorInterface;
36 void setEditorFactory(std::unique_ptr<EditorFactoryInterface> editor_factory);
37 void setCellDecoration(std::unique_ptr<CellDecoratorInterface> cell_decoration);
39 QWidget* createEditor(QWidget* parent,
const QStyleOptionViewItem& option,
40 const QModelIndex& index)
const override;
42 void setEditorData(QWidget* editor,
const QModelIndex& index)
const override;
43 void setModelData(QWidget* editor, QAbstractItemModel* model,
44 const QModelIndex& index)
const override;
46 QSize sizeHint(
const QStyleOptionViewItem& option,
const QModelIndex& index)
const override;
48 void updateEditorGeometry(QWidget* editor,
const QStyleOptionViewItem& option,
49 const QModelIndex& index)
const override;
52 void onCustomEditorDataChanged();
55 void initStyleOption(QStyleOptionViewItem* option,
const QModelIndex& index)
const override;
Model delegate to provide editing/painting for custom variants.
~ViewModelDelegate() override
std::unique_ptr< EditorFactoryInterface > m_editor_factory
std::unique_ptr< CellDecoratorInterface > m_cell_decoration
materialitems.h Collection of materials to populate MaterialModel.