How to change (remove) selection/active color of QListWidget
<p>In my <code>QListWidget</code>, there are some items that have non-default background color, I set them like so inside the custom <code>QListWidget</code> class:</p>

<pre><code>item-&gt;setBackgroundColor(qcolor); // item is of type QListWidgetItem*
</code></pre>

<p>Those non-default colors that I set are distorted by the <code>QListWidget</code>'s selection color. See an example:</p>

<p><a href="https://i.stack.imgur.com/84r9j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/84r9j.png" alt="enter image description here"></a></p>

<p>Items <code>three</code> and <code>four</code> are supposed to be the same color, but they are not since the item <code>four</code> is selected, and thus the result color is a summation of original color and <code>QListWidget</code>'s selection (active item?) color. </p>

<p>My question is how to edit or remove that selection color?</p>

<p>I tried inside my <code>QListWidget</code> (in special slot when I want to change the item's background color):</p>

<pre><code>QPalette pal = this-&gt;palette();
pal.setColor(QPalette::Highlight, QColor(255,255,255,0));
this-&gt;setPalette(pal); // updated
</code></pre>

<p>But it did not produce any effect. what am I doing wrong? Is it a correct variable to set? Do I set it up inside <code>QListWidget</code> or inside its delegate?</p>

<p><strong>Update</strong>: I tried using stylesheets as pointed by comment/answer, however, it will not be possible to use them for my application, because the items in my rows have 3 states (so I would need to use three colors). E.g., 3 states that correspond to three colors: pink for active, green for inactive and gray for the rest. When using stylesheets, I cannot set the custom property (let's say <code>QListWidget::item[Inactive="true"]</code>) to a single <code>QListWidgetItem</code>, but for the full <code>QListWidget</code>, and therefore it colors all the rows the same color.</p>

<p>Stylesheets were tried for similar problem <a href="https://forum.qt.io/topic/22219/item-view-stylesheet-bgcolor/2" rel="nofollow noreferrer">here</a>, and didn't work, therefore I make conclusion using stylesheets is not the way to go. </p>

<p>The background change method that I used originally works fine for my purpose, but I cannot figure out how to get rid of the default selection color (transparent light blue) which adds to the background color and produces the mixed color.</p>