-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworklogdelegate.cpp
More file actions
35 lines (32 loc) · 999 Bytes
/
Copy pathworklogdelegate.cpp
File metadata and controls
35 lines (32 loc) · 999 Bytes
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
33
34
35
#include "worklogdelegate.h"
#include <QDateTime>
#include <QModelIndex>
#include <QPainter>
#include <QString>
#include <QStyleOptionViewItem>
WorklogDelegate::WorklogDelegate(QObject *parent)
: QItemDelegate(parent)
{
}
void WorklogDelegate::paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
int column = index.column();
if (column == START_TIME_COLUMN || column == END_TIME_COLUMN)
{
drawDisplay(painter, option, option.rect,
index.model()->data(index).toDateTime().toString("HH:mm"));
drawFocus(painter, option, option.rect);
}
else if(column == SENT_COLUMN)
{
drawCheck(painter, option, option.rect,
index.model()->data(index).toBool() ? Qt::Checked : Qt::Unchecked);
drawFocus(painter, option, option.rect);
}
else
{
QItemDelegate::paint(painter, option, index);
}
}