title: QAbstractListModel and Qt stylesheets
body: <p>I created a list view model by inheriting from QAbstractListModel. I implemented <code>data(const QModelIndex &amp;, int )</code> to provide the list item background colour (on <code>Qt::BackgroundRole</code>) and item text color (on <code>Qt::ForegroundRole</code>).</p>
  
  <p>It works when I run my application without a stylesheet, but as soon as I apply a stylesheet (using <code>QApplication::setStyleSheet</code>) the text color ends up being wrong. The text color stays the color set in the stylesheet.</p>
  
  <p>I debugged through the model and even though it is returning, for example <code>QBrush(QColor(255, 0, 0))</code>, on the ForegroundRole it never applies to the list view.</p>
  
  <p>Is there something I need to do extra to get my list view model to work correctly when a stylesheet is set for the application?</p>
  
  <p><em>Correct Answer (from answer by king_nak)</em>
  [<a href="https://stackoverflow.com/a/41673494/1151329]">https://stackoverflow.com/a/41673494/1151329]</a>:</p>
  
  <p>I added the following in the style sheet (.qss file) after the original QListView block</p>
  
  <pre><code>QListView[default_style="true"]
  {
      color : default;
  }
  </code></pre>
  
  <p>In my code I then called </p>
  
  <pre><code>ui.listView-&gt;setProperty("default_style", QVariant(true));
  </code></pre>
  
  <p>It works well with any other QListView being styled by the style sheet, but this one with the 'default_style' property uses the palette set by the widget. </p>