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

Stylesheet issue when try to change background color with a editable combobox on hover

    XMLWordPrintable

Details

    • adafa5ee1f37739f33f6417f27c8ee7308aaad9c (qt/qtbase/dev) 93b25352568d4e8fdc1462143a6583808f9319d5 (qt/qtbase/6.1) 80fada2fef0edf184615f0d1cbe5e4df7513bbb6 (qt/qtbase/6.2) 53cdb31f293fdbe9667ce944f22343634f1866b1 (qt/tqtc-qtbase/5.15)

    Description

      When user tries to change the color on hover on a editable stylesheet, it does not work as expected.

      QComboBox
      {
          height: 36px;
          background-color: red;
          border: 1px solid blue;
          padding-left: 8px;
          padding-right: 8px;
      }
      QComboBox:editable
      {
          background-color: orange;
      }
      
      QComboBox:editable:hover   // This does not work as expected
      {
          background-color: green;
      }
      QComboBox:hover
      {
          background-color: yellow;
      }
      

      Please refer to the attached ui file. Even setting the stylesheet for QLineEdit does not work.
      Only workaround is to fetch the QLineEdit instance from comboBox and set the stylesheet to it, but it does not work when mouse is hovered on dropdown icon of ComboBox

      Attachments

        1. main.cpp
          1 kB
          Volker Hilsheimer
        2. mainwindow.ui
          2 kB
          Shveta Mittal
        3. Screenshot 2021-08-10 at 13.40.57.png
          6 kB
          Volker Hilsheimer
        For Gerrit Dashboard: QTBUG-95631
        # Subject Branch Project Status CR V

        Activity

          People

            vhilshei Volker Hilsheimer
            shmittal Shveta Mittal
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes