<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Stylesheet for the arrows on the QListView of a QCombobox]]></title><description><![CDATA[<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/e076e872-fb39-4131-a15d-cfa161492f45.png" alt="c9eb2c34-4890-4029-b1c0-589425bca94b-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">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?<br />
I found references to the arrows on QScrollBar, but i can't find references to these two.</p>
]]></description><link>https://forum.qt.io/topic/154414/stylesheet-for-the-arrows-on-the-qlistview-of-a-qcombobox</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 05:37:22 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/154414.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 08 Feb 2024 17:34:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Stylesheet for the arrows on the QListView of a QCombobox on Wed, 04 Feb 2026 22:01:04 GMT]]></title><description><![CDATA[<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/fa214320-c926-48e3-9d79-e9f3f199d18b.png" alt="Captura de tela 2026-02-04 190030.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/836023</link><guid isPermaLink="true">https://forum.qt.io/post/836023</guid><dc:creator><![CDATA[CDieguez]]></dc:creator><pubDate>Wed, 04 Feb 2026 22:01:04 GMT</pubDate></item><item><title><![CDATA[Reply to Stylesheet for the arrows on the QListView of a QCombobox on Wed, 04 Feb 2026 21:49:38 GMT]]></title><description><![CDATA[<p dir="auto">Using AI to search inside Qt 5.6.3 base code, it suggested this code to manipulate these arrows. I'd prefer using qss, but this approach actually worked.</p>
<pre><code>// Event filter to customize the painting of QComboBoxPrivateScroller widgets
class ScrollerPaintFilter : public QObject
{
public:
  ScrollerPaintFilter(int button_height, QObject* parent = nullptr)
    : QObject(parent), button_height_(button_height) {}

protected:
  bool eventFilter(QObject* obj, QEvent* event) override
  {
    if (event-&gt;type() == QEvent::Paint)
    {
      QWidget* widget = qobject_cast&lt;QWidget*&gt;(obj);
      if (widget)
      {
        QPaintEvent* paintEvent = static_cast&lt;QPaintEvent*&gt;(event);
        QPainter p(widget);
        
        // Fill background
        p.fillRect(widget-&gt;rect(), QColor(gray);
        
        // Draw border
        p.setPen(QPen(Qt::black, 1));
        p.drawRect(widget-&gt;rect().adjusted(0, 0, -1, -1));
        
        // Determine if this is up or down scroller by checking y position
        bool is_down = widget-&gt;y() &gt; widget-&gt;parentWidget()-&gt;height() / 2;
        
        // Draw arrow icon
        QPixmap arrow(is_down ? "down.png" : "up.png");
        int icon_x = widget-&gt;rect().center().x() - arrow.width() / 2;
        int icon_y = widget-&gt;rect().center().y() - arrow.height() / 2;
        p.drawPixmap(icon_x, icon_y, arrow);
        
        return true; // Event handled, don't call original paintEvent
      }
    }
    return QObject::eventFilter(obj, event);
  }

private:
  int button_height_;
};

void ComboBox::showPopup()
{
...
  // Get the popup widget
  QWidget* popup = view()-&gt;parentWidget();

  // Customize Qt's built-in scroll indicators (top and bottom arrows)
  // These are QComboBoxPrivateScroller widgets that Qt creates automatically
  QList&lt;QWidget*&gt; children = popup-&gt;findChildren&lt;QWidget*&gt;();
  ScrollerPaintFilter* filter = new ScrollerPaintFilter(popup);
  
  for (QWidget* child : children)
  {
    if (child-&gt;inherits("QComboBoxPrivateScroller"))
    {
      // Set fixed height to match button height
      child-&gt;setFixedHeight(button_height);
      
      // Install event filter to custom paint the scroller
      child-&gt;installEventFilter(filter);
    }
  }
...
}
</code></pre>
]]></description><link>https://forum.qt.io/post/836022</link><guid isPermaLink="true">https://forum.qt.io/post/836022</guid><dc:creator><![CDATA[CDieguez]]></dc:creator><pubDate>Wed, 04 Feb 2026 21:49:38 GMT</pubDate></item><item><title><![CDATA[Reply to Stylesheet for the arrows on the QListView of a QCombobox on Wed, 04 Feb 2026 21:20:24 GMT]]></title><description><![CDATA[<p dir="auto">2 years later and this is still a mistery to me, what sub-control is this two arrows in the combobox popup? I hope I can use AI today to search for it...</p>
]]></description><link>https://forum.qt.io/post/836021</link><guid isPermaLink="true">https://forum.qt.io/post/836021</guid><dc:creator><![CDATA[CDieguez]]></dc:creator><pubDate>Wed, 04 Feb 2026 21:20:24 GMT</pubDate></item><item><title><![CDATA[Reply to Stylesheet for the arrows on the QListView of a QCombobox on Fri, 09 Feb 2024 19:31:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> Sorry, I'm just not seeing it.<br />
I'm already styling "QComboBox::down-arrow" and "CComboBox::drop-down" to make the combobox look like this.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/fa9289d7-fe71-4646-8511-51178ad53796.png" alt="a6f5d50f-8fc0-4328-a5de-083c37e0f46f-image.png" class=" img-fluid img-markdown" /><br />
For smaller lists, those arrows don't appear and it looks fine.</p>
<p dir="auto">I styled "QComboBox QAbstractItemView { " to set the padding, background color, selection color, item selection border for the itens on the ListView.</p>
<p dir="auto">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.</p>
<p dir="auto">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 <a href="https://doc.qt.io/qt-6/stylesheet-reference.html#sub-line-sub" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/stylesheet-reference.html#sub-line-sub</a>, but nothing changed those two buttons.</p>
<pre><code>"CComboBox::down-arrow {"
     "background-color: red;"
"}"
"CComboBox::float-button {"
     "background-color: red;"
"}"
"CComboBox::indicator {"
     "background-color: red;"
"}"
...
</code></pre>
<p dir="auto">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.</p>
]]></description><link>https://forum.qt.io/post/789403</link><guid isPermaLink="true">https://forum.qt.io/post/789403</guid><dc:creator><![CDATA[CDieguez]]></dc:creator><pubDate>Fri, 09 Feb 2024 19:31:44 GMT</pubDate></item><item><title><![CDATA[Reply to Stylesheet for the arrows on the QListView of a QCombobox on Fri, 09 Feb 2024 06:54:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/cdieguez">@<bdi>CDieguez</bdi></a> <a href="https://doc.qt.io/qt-6/stylesheet-examples.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/stylesheet-examples.html</a><br />
See "Customizing QComboBox"</p>
]]></description><link>https://forum.qt.io/post/789295</link><guid isPermaLink="true">https://forum.qt.io/post/789295</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 09 Feb 2024 06:54:53 GMT</pubDate></item></channel></rss>