Vuo 2.4.4
Loading...
Searching...
No Matches
VuoItemDelegate.cc
Go to the documentation of this file.
1
10#include "VuoItemDelegate.hh"
11
16 : QItemDelegate(parent)
17{
18}
19
23void VuoItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
24{
25 if (index.data(Qt::AccessibleDescriptionRole).toString() == QLatin1String("separator"))
26 {
27 painter->setPen(QPen(QColor("#ddd"), 2));
28 painter->drawLine(option.rect.left(), option.rect.center().y(), option.rect.right(), option.rect.center().y());
29 }
30 else
31 QItemDelegate::paint(painter, option, index);
32}
33
37QSize VuoItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
38{
39 QString type = index.data(Qt::AccessibleDescriptionRole).toString();
40 if (type == QLatin1String("separator"))
41 return QSize(0, 20);
42
43 return QItemDelegate::sizeHint(option, index);
44}