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. QComboBox background change by setting ::drop-down border through css

QComboBox background change by setting ::drop-down border through css

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 2.7k 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.
  • ruphusR Offline
    ruphusR Offline
    ruphus
    wrote on last edited by ruphus
    #1

    Hi all.

    I'm trying to edit the style of a combo in order to remove the border around the down arrow.
    I'm using the 5.6 Qt version.

    Here is the style:

    QHeaderView::section QComboBox {
        background-color: #585A5C;
        color: #F0F0F0;
    }
    
    QComboBox::drop-down {
        border: 0;
    }
    
    QComboBox::down-arrow {
        image: url('resources/images/arrow-down.svg');
    }
    

    By setting the border inside the drow-down CSS block, the combo is painted with the default-white window background color.
    This is a quite strange behavior and I'm pretty sure that it didn't happen using Qt 5.5.
    Any clue or suggestion?

    Thanks in advance.

    1 Reply Last reply
    0
    • ruphusR Offline
      ruphusR Offline
      ruphus
      wrote on last edited by
      #2

      up after edit

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        Silly question but can you do the comparison with Qt 5.5 ?

        Otherwise you should at least post a minimal sample code that reproduces this.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • ruphusR Offline
          ruphusR Offline
          ruphus
          wrote on last edited by
          #4

          I changed the first post, inserting the previously omitted QComboBox::down-arrow style block.

          I've found a solution, that is moving the image definition from ::down-arrow to ::drop-down block, like this:

          QComboBox::drop-down {
              border: 0;
              image: url('resources/images/Caret_down_font_awesome.svg');
          }
          
          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