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

Regression[6.31->6.3.2, 6.26]: backgroundrole in QAbstractTableModel.headerData is broken (release builds only)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P1: Critical
    • Resolution: Duplicate
    • 6.2.6, 6.3.2, 6.4.0
    • None
    • Widgets: Itemviews
    • None
    • Linux/X11, Windows

    Description

      The attached C++ example qtbug107543.zip overrides QStandardItemModel::headerData() to return green for the first 2 rows and red for the rest.

      Steps to reproduce:

      • Build the example in debug mode, note colors appear as expected
      • Build the example in release mode, note colors appear randomly different. Typically, only the last row is red

      Note: It appears to be fixed in 6.4.1 .

      Originally reported against Qt for Python: When subclassing QAbstractTableModel; changing the background color of a header based on a condition sometimes work and sometimes not. 

      see attached sample model class that overrides headerData and uses Qt.BackgroundRole to change the color

      it was working fine on 6.3.1

      update: 

      I've updated the attachments to provide a working example along with screenshots of the results

      631.png demonstrates the correct outcome using 6.3.1

      632.png demonstrates the wrong outcome using 6.3.2

      Attachments

        1. 631.png
          631.png
          7 kB
        2. 632.png
          632.png
          7 kB
        3. model.py
          1.0 kB
        4. pyside2077.py
          1 kB
        5. qtbug107543.zip
          1 kB

        Issue Links

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

          Activity

            People

              vhilshei Volker Hilsheimer
              mah.emad Mahmoud Emad
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes