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

Stylesheet not working properly for the text color on ItemViews for selected items

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.0.1
    • Widgets: Style Sheets
    • None
    • This project was compiled under 4.6, 4.8 and 5.0.1 on both Windows and Mac. The bug is persistent across all versions.
    • macOS

    Description

      This is a bug where stylesheet propertiers are not respected for selected items. I have tested this with QListWidget.

      The problem is simple, as soon as QListWidget::item is styled in any way in a stylesheet, the itemview starts to behaving inappropriately, and the font color is always set to white, even if the font color was not styled, as in the attached code, only the background is styled.

      Now I assume that there is some kind of bug, if the item has a custom style and it is selected something goes haywire. This can be fixed, but the fix is very tedious, as you would have to either subclass QListWidget or connect a slot in every class you use the itemview, and implement a custom palette rule that behaves like the default class' palette should behave if styled properly.

      Attached as solution.txt.

      Attachments

        1. CSSTestQt5.pro
          0.3 kB
          Roger Weber
        2. main.cpp
          1.0 kB
          Roger Weber
        3. solution.txt
          0.4 kB
          Roger Weber
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            sir-rogers Roger Weber
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes