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

StyleSheet is ignored when changing a QComboBox to be editable

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.13.2, 5.14.0
    • Widgets: Style Sheets
    • None
    • Windows
    • 231be2e0a192f16141c12888e126bb2284b29b9f (qt/qtbase/dev) 6e470764a98434a120eba4fcc6035137cf9c92cf (qt/qtbase/5.15)

    Description

      Description

      • Create a QComboBox.
      • Apply a style-sheet to the application.
      • Make the QComboxBox editable ( execute setEditable( true ) ).
      • The background of the internal QLineEdit is not applied (but the foreground color). This is especially problematic in "dark themed" styles, since the white foreground color is indistinguishable from the white background.

      Example

      In order to reproduce compile the provided minimal example project:

      • Start the example.
      • Click "Add Box" twice (two QComboBox are added to the window).
      • Click "Editable" for the first QComboBox.
      • Click "Apply Style".
      • Click "Editable" for the second QComboBox.
      • Now the first QComboBox is correctly setup, but the second displays a white font on a white background.

      Workaround:

      A workaround is to apply the styleSheet after changing the edit state of the QComboBox, but this introduces a significant lag for larger applications.

      Attachments

        1. ComboBoxTest.pro
          1 kB
        2. image-2020-01-20-14-12-51-892.png
          image-2020-01-20-14-12-51-892.png
          14 kB
        3. main.cpp
          0.2 kB
        4. mainwindow.cpp
          2 kB
        5. mainwindow.h
          0.4 kB
        6. mainwindow.ui
          2 kB
        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
            robing Robin Gutöhrlein
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes