17#include <QItemDelegate>
37 void paint(QPainter* painter,
const QStyleOptionViewItem& option,
38 const QModelIndex& index)
const override;
41 bool editorEvent(QEvent* event, QAbstractItemModel* model,
42 const QStyleOptionViewItem& option,
43 const QModelIndex& index)
override;
45 QSize
sizeHint(
const QStyleOptionViewItem& option,
46 const QModelIndex& index)
const override;
49 QRect
checkboxRect(
const QStyleOptionViewItem& viewItemStyleOptions)
const;
CheckboxDelegate modifies a model view to display boolean values as checkboxes.
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Paints a checkbox. This overrides the default painting of a combo box.
QRect checkboxRect(const QStyleOptionViewItem &viewItemStyleOptions) const
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
Handles the click events and sets the model data.
CheckboxDelegate(QObject *parent=nullptr)
Constructor.