Setting QComboBox stylesheet reduces hight of dropdown [SOLVED]

  • Hi all,

    I want my combobox to be blue. That is achieved by setting the stylesheet:
    @combo->setStyleSheet("color: blue");@

    There is only one downside:
    Setting the above styling reduces the amount of items displayed when the combobox is clicked on the subitem list is displayed.!6780&v=3

    What can I do to set the textcolor and have all subitems of the combobox displayed when I click on the combobox.

    kind regards, reinhart

  • Moderators

    you can try this:
    QAbstractItemView * view = combo->view();
    QPalette p = view->palette();
    Not tested though.

  • Thanks a lot - works nicely!

  • qss for combo should not affect the number of visible items

    where/when do you apply the style sheet?

    just in case you could control the number of max visible items, after the style sheet setting, with:




  • Hi,
    the combobox is part of a QTableWidget. I think setting the stylesheet overwrites some default stylings (at least that is my explaination I don't know if that's true).
    Thanks for the hint with maxvisible item, though!
    regards, reinhart

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.