| 25 | } |
| 26 | |
| 27 | void QmitkLabelToggleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, |
| 28 | const QModelIndex &index) const |
| 29 | { |
| 30 | QVariant data = index.data(Qt::EditRole); |
| 31 | |
| 32 | if (data.canConvert<bool>()) |
| 33 | { |
| 34 | if (data.toBool()) |
| 35 | { |
| 36 | m_OnIcon.paint(painter, option.rect); |
| 37 | } |
| 38 | else |
| 39 | { |
| 40 | m_OffIcon.paint(painter, option.rect); |
| 41 | } |
| 42 | } |
| 43 | else |
| 44 | { |
| 45 | QStyledItemDelegate::paint(painter, option, index); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | QSize QmitkLabelToggleItemDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const |
| 50 | { |