title: Qt dynamically change bg color without overwriting other styles
body: <p>Okay what I am aiming for is a way to set the background color of a <code>QGroupBox</code> without overwriting any other styles that might be set on that object before.</p>
  <p>Intuitively I'd use a <code>QPalette</code> for doing this but since my application is using stylesheets, I can't use palettes (using them just has no effect whatsoever).</p>
  <p>Thus I am left with setting the background color via stylesheets. If the only style I want to set this was the background color, that'd be easy:</p>
  <pre><code>myBox-&gt;setStyleSheet(&quot;background-color: red;&quot;);
  </code></pre>
  <p>This however will overwrite all stylesheets that have been set on <code>myBox</code> before this call. In my case I am setting the font-size at a different place but on the same object and also via stylesheets.</p>
  <p>So the next idea is to append to the existing stylesheet like this:</p>
  <pre><code>myBox-&gt;setStyleSheet(myBox-&gt;styleSheet() + &quot; background-color: red;&quot;);
  </code></pre>
  <p>That's working so far, but the problem is that I want to change the background color rather frequently (not only once or twice) and while using the above method for the successive color changes (provided I append to the the stylesheet instead of prepending to it), it makes the stylesheet continually grow larger and larger. Furthermore I'd eventually be setting the background color hundreds of times in one and the same stylesheet just so I can have the currently active color as the final value. Parsing this seems like a huge waste of computational resources.</p>
  <p>I am therefore looking for a way to change the background color of my box only. The method must preserve all attributes that are currently set in a stylesheet on my object (except the background color of course) and should not make the stylesheet grow to infinity without actually adding new information to it. And ideally the solution is <strong>not</strong> cascading the background color to children of my box.</p>
  <p>How is something like this usually handled within Qt?</p>
  <hr />
  <p>A possible solution that I could come up with would be to create a wrapper around the <code>QGroupBox</code> and introduce the style attributes I want to set on it as member variables and  then creating the stylesheet based on the values of the member variables each time any of them changes.</p>
  <p>This seems like a solution that doesn't scale very well and to me it seems like there should be a standard solution to this that doesn't require manually creating such wrappers every time...</p>