title: Dark Theme with extended properties
body: <h2>Goal</h2>
  <p>While building a pyqt5 based gui that includes <code>QListWidget</code> with many dynamicly generated <code>QListWidgetItem</code>. Some of the <code>QListWidgetItem</code> have colors indicator based on properties of what they open when clicked.</p>
  <p>So far i only used the default color theme and used a brush with .setBackground to each of the list items at creation to get the color scheme i had in mind.</p>
  <p>Right now i attempt at adding a new dark theme while also changing colors dynamicly after the creation of the objects. To do that i created a new palette and set the palette for the app.</p>
  <h2>expected and actual results</h2>
  <p>To handle the list items i first attempted at setting a property as follows:</p>
  <pre class="lang-py prettyprint-override"><code>item.setProperty('cool', True)
  </code></pre>
  <p>This returned an error indicating <code>QListWidgetItem</code> has no <code>setProperty</code> attribute which i think the reasen for is that <code>QListWidgetItem</code> does not inherit <code>QObject</code></p>
  <p>Then i attempted at creating my own class to set the property:</p>
  <pre class="lang-py prettyprint-override"><code>class ThemedQListWidgetItem(QListWidgetItem):
      def __init__(self, *args, **kwargs):
          QListWidgetItem.__init__(self, *args, **kwargs)
          self.cool = False
  </code></pre>
  <p>and setting the colors using:</p>
  <pre class="lang-py prettyprint-override"><code>app.setPalette(darkPalette)
  app.setStyleSheet(&quot;&quot;&quot;
              ThemedQListWidgetItem[cool=&quot;true&quot;] {
                  background-color: red;}
              ThemedQListWidgetItem[cool=&quot;false&quot;] {
                  background-color: palette(base);}
          &quot;&quot;&quot;)
  
  </code></pre>
  <p>The dark theme is applied but no red colored items are shown, and I don't get any errors.</p>
  <p>Maybe im doing something wrong regarding the way pyqt is ment to be used. There must be a simple way to dynamicly change colors based on properties of gui elements.</p>
  <p>While i could rebuild the whole list from scratch every time i doubt there isn't a better way.</p>
  <h2>My enviorment</h2>
  <ul>
  <li>Archlinux x64 kernel 5.10.5</li>
  <li>Desktop Enviorment: Xfce4</li>
  <li>Window Maneger:     Xfwm4</li>
  <li>Python Version:     3.9.1</li>
  <li>Pyqt5 Version:      5.15.2</li>
  </ul>