<?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[QTreeWidgetItems and gradients, is it possible?]]></title><description><![CDATA[<p dir="auto">Hi there,</p>
<p dir="auto">I have a QTreeWidget where I need the text of the different items to be of different colors. QTreeWidgetItem::setForeground works great as long as you use a brush that's a single color, but I thought it'd be nice to use linear gradients instead. However nothing I do seems to work. For example:</p>
<p dir="auto">@<br />
QLinearGradient l_gradient(0,0,100,100);<br />
l_gradient.setColorAt(0, Qt::blue);<br />
l_gradient.setColorAt(1, Qt::white);</p>
<p dir="auto">QBrush l_brush (l_gradient);<br />
lp_item-&gt;setForeground(0, l_brush);<br />
@</p>
<p dir="auto">appears to do nothing. Am I doing it wrong, or are gradients for tree widget items just not supported at this point?</p>
<p dir="auto">Thanks, Nir</p>
]]></description><link>https://forum.qt.io/topic/8248/qtreewidgetitems-and-gradients-is-it-possible</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 15:47:14 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/8248.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Aug 2011 01:53:52 GMT</pubDate><ttl>60</ttl></channel></rss>