Minor cosmetic changes
[timedsilencer] / eventlistdelegate.cpp
index 600d547..36bcda0 100644 (file)
@@ -25,13 +25,16 @@ EventListDelegate::EventListDelegate()
 }
 
 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");
@@ -42,9 +45,5 @@ void EventListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt
     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);
   }
 }