}
void EventListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
+ QStyleOptionViewItem opt = option;
+ opt.displayAlignment = Qt::AlignCenter;
+ QStyledItemDelegate::paint(painter, opt, index);
if(index.column() == EV_STATUS) {
// Draw checkbox
QIcon::fromTheme("general_tickmark_checked");
// Is selected
// Draw checkbox
QIcon cbIco;
- if(index.data().toBool()) {
+ if(index.data(Qt::UserRole).toBool()) {
cbIco = QIcon::fromTheme("clock_alarm_on");
} else {
cbIco = QIcon::fromTheme("clock_alarm_off");
cbRect.setHeight(cbPix.height());
cbRect.moveCenter(option.rect.center());;
painter->drawPixmap(cbRect, cbPix);
- } else {
- QStyleOptionViewItem opt = option;
- opt.displayAlignment = Qt::AlignCenter;
- QStyledItemDelegate::paint(painter, opt, index);
}
}