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. Stylesheet for the arrows on the QListView of a QCombobox
Forum Updated to NodeBB v4.3 + New Features

Stylesheet for the arrows on the QListView of a QCombobox

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 603 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.
  • C Offline
    C Offline
    CDieguez
    wrote on last edited by CDieguez
    #1

    c9eb2c34-4890-4029-b1c0-589425bca94b-image.png

    I'm trying to create a stylesheet for a QCombobox and this is the QListView that pops when I select the QCombobox. How can I style those arrows on the top and bottom of the list?
    I found references to the arrows on QScrollBar, but i can't find references to these two.

    jsulmJ 1 Reply Last reply
    0
    • C CDieguez

      c9eb2c34-4890-4029-b1c0-589425bca94b-image.png

      I'm trying to create a stylesheet for a QCombobox and this is the QListView that pops when I select the QCombobox. How can I style those arrows on the top and bottom of the list?
      I found references to the arrows on QScrollBar, but i can't find references to these two.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @CDieguez https://doc.qt.io/qt-6/stylesheet-examples.html
      See "Customizing QComboBox"

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply
      1
      • jsulmJ jsulm

        @CDieguez https://doc.qt.io/qt-6/stylesheet-examples.html
        See "Customizing QComboBox"

        C Offline
        C Offline
        CDieguez
        wrote on last edited by CDieguez
        #3

        @jsulm Sorry, I'm just not seeing it.
        I'm already styling "QComboBox::down-arrow" and "CComboBox::drop-down" to make the combobox look like this.
        a6f5d50f-8fc0-4328-a5de-083c37e0f46f-image.png
        For smaller lists, those arrows don't appear and it looks fine.

        I styled "QComboBox QAbstractItemView { " to set the padding, background color, selection color, item selection border for the itens on the ListView.

        The only things in the example I'm not using are the "on" and "editable" states. I'm not planning on allowing the user to edit the combobox and I don't want it to look different if it's on or not.

        To see if I could change the color of those arrow buttons to red, I literally tried styling something similar to the example below for every sub-control on the List of Sub-Controls in this link https://doc.qt.io/qt-6/stylesheet-reference.html#sub-line-sub, but nothing changed those two buttons.

        "CComboBox::down-arrow {"
             "background-color: red;"
        "}"
        "CComboBox::float-button {"
             "background-color: red;"
        "}"
        "CComboBox::indicator {"
             "background-color: red;"
        "}"
        ...
        

        I'm just looking for the name of these sub-controls or if they should be addressed as another class instead of a sub-control. I really would appreciate an example like the ones above that could turn those two arrows red or set an image or change them in any way.

        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