TableView Header problem
-
Hi,
What do you mean by it doesn't happen ? The role is never
Qt::BackgroundRole
? Or your brush has no effect ? -
I quote from QT 5.6 QHeaderView Class, section on appearance:
"Not all ItemDataRoles will have an effect on a QHeaderView. If you need to draw other roles, you can subclass QHeaderView and reimplement paintEvent(). QHeaderView respects the following item data roles: TextAlignmentRole, DisplayRole, FontRole, DecorationRole, ForegroundRole, and BackgroundRole."
So, BackgroundRole should give background colour to the headerview but mine stay white. I can change the font and I can change the foreground colour (text colour).
-
What OS are you running ?
-
Setting the background role will modify the QPalette used for the painting and from the QPalette documentation, styles using native theme engines may not use the palette for all drawings.