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

StyleSheet is ignored when changing a QComboBox to be editable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important 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

      • 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.

        1. ComboBoxTest.pro
          1 kB
          Robin Gutöhrlein
        2. image-2020-01-20-14-12-51-892.png
          14 kB
          Robin Gutöhrlein
        3. main.cpp
          0.2 kB
          Robin Gutöhrlein
        4. mainwindow.cpp
          2 kB
          Robin Gutöhrlein
        5. mainwindow.h
          0.4 kB
          Robin Gutöhrlein
        6. mainwindow.ui
          2 kB
          Robin Gutöhrlein
        For Gerrit Dashboard: QTBUG-81533
        # Subject Branch Project Status CR V

            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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes