-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitemdelegate.cpp
32 lines (30 loc) · 1.65 KB
/
itemdelegate.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "itemdelegate.h"
ItemDelegate::ItemDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
QStyleOptionViewItem opt=option;
opt.font.setBold(!index.data(Qt::FontRole).toBool());
if (index.column()==13) {
if (index.data().toBool()) {
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
//painter->setPen(Qt::NoPen);
QPolygon poly;
int yjump = (option.rect.height()/10);
int xjump = (option.rect.width()/10);
poly << QPoint(option.rect.x()+(xjump*5),option.rect.y()+yjump)
<< QPoint(option.rect.x()+(xjump*5)+yjump,option.rect.y()+(yjump*4))
<< QPoint(option.rect.x()+(xjump*5)+(yjump*4),option.rect.y()+(yjump*4))
<< QPoint(option.rect.x()+(xjump*5)+(yjump*2),option.rect.y()+(yjump*6))
<< QPoint(option.rect.x()+(xjump*5)+(yjump*3),option.rect.y()+(yjump*9))
<< QPoint(option.rect.x()+(xjump*5),option.rect.y()+(yjump*7))
<< QPoint(option.rect.x()+(xjump*5)-(yjump*3),option.rect.y()+(yjump*9))
<< QPoint(option.rect.x()+(xjump*5)-(yjump*2),option.rect.y()+(yjump*6))
<< QPoint(option.rect.x()+(xjump*5)-(yjump*4),option.rect.y()+(yjump*4))
<< QPoint(option.rect.x()+(xjump*5)-yjump,option.rect.y()+(yjump*4));
painter->drawPolygon(poly,Qt::WindingFill);
painter->restore();
}
return;
}
QStyledItemDelegate::paint(painter,opt,index);
}