Solved How Paint a background section in a QHeaderView?
-
So I was trying to color the background of certain cells based on the data on them, will implement the logic later. The problem Now Is that in the code below fillrect paints everything and erases the text of the header section. How Can I paint the text and the background color?
void ResizableVerticalHeader::paintSection(QPainter* painter, const QRect& rect, int logicalIndex) const { painter->save(); QHeaderView::paintSection(painter, rect, logicalIndex); painter->restore(); painter->fillRect(rect, QBrush(QColor(0xE1, 0xFF, 0x3C))); }
-
Since you don't call the base class impl - what do you expect?
Overrride initStyleOption() and set the desired color for QPalette::Window or even better override initStyleOptionForIndex()
-
Since you don't call the base class impl - what do you expect?
Overrride initStyleOption() and set the desired color for QPalette::Window or even better override initStyleOptionForIndex()
-