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

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

    XMLWordPrintable

Details

    • 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
          csding
        2. TestBackground.zip
          3 kB
          csding
        3. with_setStyle.png
          38 kB
          Jagadish Kumar P
        4. wo_setStyle.png
          35 kB
          Jagadish Kumar P

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              vhilshei Volker Hilsheimer
              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