comparison ui/certificateitemdelegate.cpp @ 372:6cc124e79066

Add save/load unselected and add role enumerator Explicitly naming the roles avoids confusion and makes the code more readable
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 15 Apr 2014 11:56:29 +0200
parents dd6a09d2699f
children 9e38a4bcd44e
comparison
equal deleted inserted replaced
371:6b78a89c1e17 372:6cc124e79066
1 #include <QtWidgets> 1 #include <QtWidgets>
2 2
3 #include "certificate.h" 3 #include "certificate.h"
4 #include "mainwindow.h"
4 #include "certificateitemdelegate.h" 5 #include "certificateitemdelegate.h"
5 6
6 void CertificateItemDelegate::paint(QPainter *painter, 7 void CertificateItemDelegate::paint(QPainter *painter,
7 const QStyleOptionViewItem &option, const QModelIndex &index) const 8 const QStyleOptionViewItem &option, const QModelIndex &index) const
8 { 9 {
9 // Save the current painter. 10 // Save the current painter.
10 painter->save(); 11 painter->save();
11 int status = index.data(Qt::UserRole + 1).toInt(); 12 int status = index.data(MainWindow::StatusRole).toInt();
12 if (status == 0) { 13 if (status == 0) {
13 // This status is not known, so draw the default item. 14 // This status is not known, so draw the default item.
14 QStyledItemDelegate::paint(painter, option, index); 15 QStyledItemDelegate::paint(painter, option, index);
15 painter->restore(); 16 painter->restore();
16 return; 17 return;

http://wald.intevation.org/projects/trustbridge/