-
Notifications
You must be signed in to change notification settings - Fork 0
/
mynoeditdelegate.cpp
44 lines (26 loc) · 1 KB
/
mynoeditdelegate.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
33
34
35
36
37
38
39
40
41
42
43
#include "mynoeditdelegate.h"
MyNoEditDelegate::MyNoEditDelegate()
{
}
QWidget *MyNoEditDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
return 0;
}
void MyNoEditDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
}
void MyNoEditDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
}
void MyNoEditDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
}
void MyNoEditDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionViewItemV4 myOption = option;
myOption.text = index.data().toString();
myOption.displayAlignment = Qt::AlignCenter;
myOption.backgroundBrush = (QBrush(QColor(255, 255, 242, 200)));
//background-color: rgb(255, 255, 242);
QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &myOption, painter);
}