12 : QStyledItemDelegate(parent)
44 const QModelIndex &index)
const
49 QCheckBox *editor =
new QCheckBox(parent);
50 editor->setChecked(index.data(Qt::DisplayRole).toBool());
60 QVariant var = index.data(Qt::DisplayRole);
63 QLabel *label =
static_cast<QLabel*
>(editor);
64 label->setText(var.toString());
68 QCheckBox *chkbox =
static_cast<QCheckBox*
>(editor);
69 if (var.toString()==
"No")
70 chkbox->setChecked(
false);
72 chkbox->setChecked(
true);
76 const QModelIndex &index)
const
81 QCheckBox *chkbox =
static_cast<QCheckBox*
>(editor);
83 if (chkbox->checkState()==Qt::CheckState::Checked)
84 model->setData(index,
true);
86 model->setData(index,
false);
92 const QStyleOptionViewItem &option,
const QModelIndex &)
const
94 editor->setGeometry(option.rect);
98 const QModelIndex &index)
const
100 QStyledItemDelegate::paint(painter, option, index);
QVector< column_type > columnTypes
QWidget * createEditor(QWidget *parent, 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
SelectSampleDelegate(SourceSinkData *data, QObject *parent)
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override