Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31804

Setting background of QHeaderView using model's headerData() doesn't work

    XMLWordPrintable

    Details

    • Commits:
      804a18ef0ec4a054778e223c8cec6ee26dec3f76 (qt/qtbase/5.12)

      Description

      QHeaderView does not respect BackgroundRole or DecorationRole as described in the documentation under Appearance: "QHeaderView respects the following item data roles: TextAlignmentRole, DisplayRole, FontRole, DecorationRole, ForegroundRole, and BackgroundRole."

      Setting color or style of fonts (ForegroundRole or FontRole, respectively) in headerData() is working, but BackgroundRole is not respected, either by returning "QVariant(QColor(Qt::blue))" or "QBrush(QColor(Qt::blue))". Likewise, DecorationRole is ignored in headerData().

        Attachments

        1. running_result.zip
          7 kB
        2. TestBackground.zip
          3 kB
        3. with_setStyle.png
          with_setStyle.png
          38 kB
        4. wo_setStyle.png
          wo_setStyle.png
          35 kB

          Issue Links

          For Gerrit Dashboard: QTBUG-31804
          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              vhilshei Volker Hilsheimer
              Reporter:
              csding csding
              Votes:
              5 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes