Implement paintSection for QHeaderView delivered class
问题 protected: virtual void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const { QHeaderView::paintSection(painter, rect, logicalIndex); painter->drawRect(2, 2, 10, 10); } Rectangle is not painting. But when paintSection removed it is painting. I need to draw rectangle after call base paintSection. 回答1: As it was answered in this your question, rect is an area your should paint at. If you paint outside of this area your drawings might be erased by painting of other cells.