Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to customize drop-down of hovered QtComboBox in stylesheet
Qt 6.11 is out! See what's new in the release blog

How to customize drop-down of hovered QtComboBox in stylesheet

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 863 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Samuel Xue
    wrote on last edited by
    #1

    I'm working on making a style for my application in stylesheet. I 'm in trouble to write the rule of customizing the drop-down background when a QComboBox is hovered. It seems the selector 'QComboBox::drop-down:hover' only works when the drop-down is hovered, and 'QComboBox:hover::drop-down' is not a valid selector.

    Does anyone have ideal on this?

    Pl45m4P JoeCFDJ 2 Replies Last reply
    0
    • S Samuel Xue

      I'm working on making a style for my application in stylesheet. I 'm in trouble to write the rule of customizing the drop-down background when a QComboBox is hovered. It seems the selector 'QComboBox::drop-down:hover' only works when the drop-down is hovered, and 'QComboBox:hover::drop-down' is not a valid selector.

      Does anyone have ideal on this?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @Samuel-Xue

      Not tested (just an idea)

      Try:

      QComboBox::hovered QAbstractItemView {
          YourStyle: here;
      }
      

      The drop down is a QAbstractItemView and it may (or may not) apply the style when set as above, if the comboBox is hovered.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      S 1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @Samuel-Xue

        Not tested (just an idea)

        Try:

        QComboBox::hovered QAbstractItemView {
            YourStyle: here;
        }
        

        The drop down is a QAbstractItemView and it may (or may not) apply the style when set as above, if the comboBox is hovered.

        S Offline
        S Offline
        Samuel Xue
        wrote on last edited by
        #3

        @Pl45m4
        Sorry, let me make this question clear. The drop-down here means the drop-down button, not the drop down list.

        1 Reply Last reply
        0
        • S Samuel Xue

          I'm working on making a style for my application in stylesheet. I 'm in trouble to write the rule of customizing the drop-down background when a QComboBox is hovered. It seems the selector 'QComboBox::drop-down:hover' only works when the drop-down is hovered, and 'QComboBox:hover::drop-down' is not a valid selector.

          Does anyone have ideal on this?

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by
          #4

          @Samuel-Xue said in How to customize drop-down of hovered QtComboBox in stylesheet:

          QComboBox::drop-down:hover

          https://stackoverflow.com/questions/52782279/how-to-change-drop-down-background-color-on-qcombobox-hover

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved