| 45 | } |
| 46 | |
| 47 | void ColorPickerDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const |
| 48 | { |
| 49 | QColorDialog *colorDialog = static_cast<QColorDialog*>(editor); |
| 50 | QColor color = colorDialog->selectedColor(); |
| 51 | |
| 52 | if (color.isValid()) { |
| 53 | model->setData(index, color, Qt::EditRole); |
| 54 | } |
| 55 | } |