| 31 | } |
| 32 | |
| 33 | void SpreadsheetItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { |
| 34 | QItemDelegate::paint(painter, option, index); |
| 35 | if (!index.data(static_cast<int>(SpreadsheetModel::CustomDataRole::MaskingRole)).toBool()) |
| 36 | return; |
| 37 | |
| 38 | painter->save(); |
| 39 | painter->fillRect(option.rect, QBrush(m_maskingColor, Qt::BDiagPattern)); |
| 40 | painter->restore(); |
| 41 | } |
| 42 | |
| 43 | void SpreadsheetItemDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const { |
| 44 | model->setData(index, editor->metaObject()->userProperty().read(editor), Qt::EditRole); |