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 stylesheet issue
Forum Updated to NodeBB v4.3 + New Features

QCombobox stylesheet issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 213 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.
  • M Offline
    M Offline
    MD25
    wrote last edited by
    #1

    I tried adjusting the style of me combosox. So that the dropdown menu has rounded corners, just like the combobox itself. This works partially. You can see the rounded dropdown menu but behind it you can also see the defaul square dropdown menu from Qt, i presume. I dont now how to get rid of it.!
    177d1d6c-9cf6-46f3-922f-88f4cceb8379-image.png

    6e12b099-2f79-4643-b459-4e25f18bec39-image.png

    This is my stylesheet:
    QString cleanComboBoxStyle1 =
    "QComboBox {"
    " border: 1px solid #CDE0C9;" // Light sage border
    " border-radius: 6px;"
    " color: #2C6975;" // Dark teal text
    " background-color: white;"
    " padding: 6px 12px;"
    " font-size: 12px;"
    " min-height: 18px;"
    "}"
    "QComboBox:hover {"
    " border-color: #68B2A0;" // Medium teal border on hover
    " background-color: #F5F5F5;" // Off-white background
    "}"
    "QComboBox:focus {"
    " border-color: #2C6975;" // Dark teal border on focus
    " background-color: white;"
    "}"
    "QComboBox::drop-down {"
    " subcontrol-origin: border;"
    " subcontrol-position: right;"
    " width: 10px;"
    " height: 20px;"
    " border: none;"
    " background-color: #E0ECDE;"
    "}"
    "QComboBox::down-arrow {"
    " color: #68B2A0;" // Medium teal arrow
    " width: 12px;"
    " height: 12px;"
    "}"
    "QComboBox QAbstractItemView {"
    " border: 1px solid #CDE0C9;"
    " background-color: white;"
    " color: #2C6975;"
    " selection-background-color: #E0ECDE;" // Very light sage selection
    " selection-color: #2C6975;"
    " outline: none;"
    " border-radius: 6px;"
    " show-decoration-selected: 1;"
    "}"
    "QComboBox QAbstractItemView::item {"
    " padding: 8px 12px;"
    " color: #2C6975;"
    " border: none;"
    " background-color: white;"
    " min-height: 20px;"
    "}"
    "QComboBox QAbstractItemView::item:hover {"
    " background-color: #F5F5F5;" // Off-white hover
    " color: #2C6975;"
    "}"
    "QComboBox QAbstractItemView::item:selected {"
    " background-color: #E0ECDE;" // Very light sage selection
    " color: #2C6975;"
    "}";

    After creating my comboboxes, i just apply the stylesheet with the setStyleSheet method.
    I would appreciate any help.

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

      Hi and welcome to devnet,

      Shouldn't you set the radius on the drop-down as well ?

      See the QComboBox example in the stylesheet documentation.

      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

      • Login

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