52 QRect remainingArea = areaRect;
55 QColor bgFillColor =
palette().color(QPalette::Base);
57 QVariant variant = model()->headerData(layerIndex, orientation(), Qt::BackgroundRole);
58 if (variant.canConvert<QBrush>()) {
59 QBrush brush = qvariant_cast<QBrush>(variant);
60 painter->setBrush(brush);
61 painter->setPen(Qt::NoPen);
62 painter->drawRect(areaRect);
64 bgFillColor = brush.color();
67 QColor rimlight = bgFillColor.lighter(115);
68 painter->setPen(QPen(rimlight, 2));
69 painter->setBrush(rimlight);
70 painter->drawLine(areaRect.topLeft(), areaRect.topRight());
78 const int lineWidth = 2;
80 painter->setPen(QPen(lineColor, lineWidth));
81 painter->setBrush(lineColor);
84 lines << QLine(areaRect.topLeft(), areaRect.topRight()).translated(0,1);
85 lines << QLine(areaRect.bottomLeft(), areaRect.bottomRight()).translated(0,-1);
86 painter->drawLines(lines);
92 const uint pinWidth = areaRect.height() - 4;
93 QRect pinArea =
kisTrimLeft(pinWidth, remainingArea);
94 const uint difference = pinArea.height() - pinWidth;
95 pinArea.setHeight(pinWidth);
96 pinArea.translate(0, difference / 2);
99 QRect iconRect = pinArea - QMargins(5,5,5,5);
102 iconRect = pinArea - QMargins(6,4,4,6);
103 painter->setOpacity(0.35);
106 icon.paint(painter, iconRect);
110 const int textSpace = remainingArea.width() -
m_d->iconSectionWidth(layerIndex);
111 const QRect textArea =
kisTrimLeft(textSpace, remainingArea);
112 QString text = model()->headerData(layerIndex, orientation(), Qt::DisplayRole).toString();
113 text = fontMetrics().elidedText(text, textElideMode(), textArea.width());
114 style()->drawItemText(painter, textArea, Qt::AlignLeft | Qt::AlignVCenter,
palette(), isEnabled(), text, QPalette::ButtonText);
120 const int numIcons =
m_d->numIcons(layerIndex);
121 for (
int i = 0; i < numIcons; i++) {
124 const bool isActive = prop->
state.toBool();
127 painter->setOpacity(0.35);
129 QRect iconRect =
m_d->propertyIconRect(layerIndex, i).translated(areaRect.topLeft());
130 icon.paint(painter, iconRect);
131 painter->setOpacity(1.0);
268 int layerIndex = logicalIndexAt(e->pos());
269 if (layerIndex != -1) {
271 QRect layerHeaderRect =
m_d->getSectionRect(layerIndex);
272 const uint pinWidth = layerHeaderRect.height() - 4;
273 QRect pinArea =
kisTrimLeft(pinWidth, layerHeaderRect);
274 if (pinArea.contains(e->pos())) {
281 const int propertyIconIndex =
m_d->propertyIconAt(layerIndex, e->pos());
282 if (propertyIconIndex != -1) {
287 m_d->getPropertyAt(props, propertyIconIndex);
289 bool currentState =
p->
state.toBool();
290 p->state = !currentState;
292 value.setValue(props);
297 }
else if (e->button() == Qt::RightButton) {
301 }
else if (e->button() == Qt::LeftButton) {
306 QHeaderView::mousePressEvent(e);