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

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

XMLWordPrintable

    • 804a18ef0ec4a054778e223c8cec6ee26dec3f76 (qt/qtbase/5.12)

      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().

        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
        For Gerrit Dashboard: QTBUG-31804
        # Subject Branch Project Status CR V

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes