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. Hover color of QComboBox is Not fixing ?
Qt 6.11 is out! See what's new in the release blog

Hover color of QComboBox is Not fixing ?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 2.4k Views
  • 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.
  • V Offline
    V Offline
    veer
    wrote on last edited by
    #1

    Hi I tried to fix the hover color of the comboBox but it is not working . I wan it to be something rgb(242,243,243 but it has default color i.e blue

    comboxhoverColor.PNG

        this->setStyleSheet(
                    "QLabel{ "
                    "font-family: Helvetica;"
                    "font-weight: normal;"
                    "font-size: 9pt;"
                    "color: rgb(72,79,83);"
                    "}"
    
                    "QComboBox {"
                    "background-color: rgb(255,255,255);"
                    "border-top: none;"
                    "border-left: none;"
                    "border-right: none;"
                    "border-bottom:1px solid rgb(138,147,155);"
                    "font-family: Helvetica;"
                    "font-weight: normal;"
                    "font-size: 9pt;"
                    "color: rgb(72,79,83);"
                    "}"
                    "QComboBox::drop-down {"
                    "width: 25px;"
                    "border: 0px;"
                    "color:rgb(72,79,83);"
                    "}"
                    "QComboBox::hover{"
                    "background: rgb(242,243,243);"
                    "}"
                    "QComboBox::down-arrow {"
                    "image: url(:/images/Dropdown.png);"
                    "width: 8px;"
                    "height: 8px; "
                    "}"
    
                    "QLineEdit {"
                    "background-color: rgb(255,255,255);"
                    "border-top: none;"
                    "border-left: none;"
                    "border-right: none;"
                    "border-bottom:1px solid rgb(138,147,155);"
                    "font-family: Helvetica;"
                    "font-weight: normal;"
                    "font-size: 9pt;"
                    "color: rgb(72,79,83);"
                    "}"
                    );
    
    RatzzR B 2 Replies Last reply
    0
    • V veer

      Hi I tried to fix the hover color of the comboBox but it is not working . I wan it to be something rgb(242,243,243 but it has default color i.e blue

      comboxhoverColor.PNG

          this->setStyleSheet(
                      "QLabel{ "
                      "font-family: Helvetica;"
                      "font-weight: normal;"
                      "font-size: 9pt;"
                      "color: rgb(72,79,83);"
                      "}"
      
                      "QComboBox {"
                      "background-color: rgb(255,255,255);"
                      "border-top: none;"
                      "border-left: none;"
                      "border-right: none;"
                      "border-bottom:1px solid rgb(138,147,155);"
                      "font-family: Helvetica;"
                      "font-weight: normal;"
                      "font-size: 9pt;"
                      "color: rgb(72,79,83);"
                      "}"
                      "QComboBox::drop-down {"
                      "width: 25px;"
                      "border: 0px;"
                      "color:rgb(72,79,83);"
                      "}"
                      "QComboBox::hover{"
                      "background: rgb(242,243,243);"
                      "}"
                      "QComboBox::down-arrow {"
                      "image: url(:/images/Dropdown.png);"
                      "width: 8px;"
                      "height: 8px; "
                      "}"
      
                      "QLineEdit {"
                      "background-color: rgb(255,255,255);"
                      "border-top: none;"
                      "border-left: none;"
                      "border-right: none;"
                      "border-bottom:1px solid rgb(138,147,155);"
                      "font-family: Helvetica;"
                      "font-weight: normal;"
                      "font-size: 9pt;"
                      "color: rgb(72,79,83);"
                      "}"
                      );
      
      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by Ratzz
      #2

      @veer
      Did you mean selection color ?
      Can you try with selection-background-color for your QComboBox ?

      --Alles ist gut.

      1 Reply Last reply
      1
      • V veer

        Hi I tried to fix the hover color of the comboBox but it is not working . I wan it to be something rgb(242,243,243 but it has default color i.e blue

        comboxhoverColor.PNG

            this->setStyleSheet(
                        "QLabel{ "
                        "font-family: Helvetica;"
                        "font-weight: normal;"
                        "font-size: 9pt;"
                        "color: rgb(72,79,83);"
                        "}"
        
                        "QComboBox {"
                        "background-color: rgb(255,255,255);"
                        "border-top: none;"
                        "border-left: none;"
                        "border-right: none;"
                        "border-bottom:1px solid rgb(138,147,155);"
                        "font-family: Helvetica;"
                        "font-weight: normal;"
                        "font-size: 9pt;"
                        "color: rgb(72,79,83);"
                        "}"
                        "QComboBox::drop-down {"
                        "width: 25px;"
                        "border: 0px;"
                        "color:rgb(72,79,83);"
                        "}"
                        "QComboBox::hover{"
                        "background: rgb(242,243,243);"
                        "}"
                        "QComboBox::down-arrow {"
                        "image: url(:/images/Dropdown.png);"
                        "width: 8px;"
                        "height: 8px; "
                        "}"
        
                        "QLineEdit {"
                        "background-color: rgb(255,255,255);"
                        "border-top: none;"
                        "border-left: none;"
                        "border-right: none;"
                        "border-bottom:1px solid rgb(138,147,155);"
                        "font-family: Helvetica;"
                        "font-weight: normal;"
                        "font-size: 9pt;"
                        "color: rgb(72,79,83);"
                        "}"
                        );
        
        B Offline
        B Offline
        Bonnie
        wrote on last edited by
        #3

        @veer
        Please refer to the doc: https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcombobox
        What you want to set is not hover of QComboBox, but the selection of the pop-up, so it should be

        QComboBox QAbstractItemView {
            selection-background-color: rgb(242,243,243);
        }
        
        V 1 Reply Last reply
        2
        • B Bonnie

          @veer
          Please refer to the doc: https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qcombobox
          What you want to set is not hover of QComboBox, but the selection of the pop-up, so it should be

          QComboBox QAbstractItemView {
              selection-background-color: rgb(242,243,243);
          }
          
          V Offline
          V Offline
          veer
          wrote on last edited by
          #4

          @Bonnie thanks dear it works although I tried it earlier also but it didn't work at that time and since I was not sure about working of QAbstratItemView that's why I removed it . After your reply I knew that I have to work like this so I wondering why it is not working then, and fount that stylesheet is setting at more than one places . Anyway thanks man ……….

          1 Reply Last reply
          0

          • Login

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