title: Drawing Qt controls in paintEvent with respecting style sheets properties
body: <p>Is there a class or method in Qt to get properties like "border-color", "border-style", ...</p>
  
  <p>This may be usefull to create and paint own (derived) controls based on currently selected style sheets.</p>
  
  <p><strong>Example</strong>:</p>
  
  <pre><code>QPushButton {
      border: 3px solid red;
      background: blue;
      margin: 5px;
      padding: 10px;
  }
  </code></pre>
  
  <p>The code:</p>
  
  <pre><code>class QPushButtonCircle : public QPushButton {
  };
  </code></pre>
  
  <p>QPushButtonCircle would be a button that is circular. Even the border is circular. The border should 3 pixels width, solid and colored red. The background should be colored blue.</p>
  
  <p>I din't find any way expect drawing entierly in paintEvent and ignoring any style sheets. But there must be a better way.</p>
  
  <p>The best would be something like:</p>
  
  <pre><code>QCssStyle cssStyle = widget-&gt;...-&gt;getCssStyle();
  
  QPen border = cssStyle-&gt;border(QCssStyle::Top);
  QBrush background = cssStyle-&gt;background();
  QMargins margins = cssStyle-&gt;margins();
  QMargins padding = cssStyle-&gt;padding();
  ...
  </code></pre>
  
  <p>This would allow us to draw our own controls like in:</p>
  
  <pre><code>QStylePainter p(this);
  
  QRect r = rect();
  r.adjust(cssStyle-&gt;margins().left(), ...);
  
  p.setPen(cssStyle-&gt;border());
  p.setBrush(cssStyle-&gt;brush());
  p.drawEllipse(r);
  
  r.adjust(cssStyle-&gt;padding().left(), ...);
  p.drawText(r, ...);
  </code></pre>
  
  <p>A better solution would be a method to draw things like with <code>QStyle::drawControl</code>, <code>QStyle::drawPrimitive</code>... but with respecting a QPainterPath (or simpler primitives) instead of assuming rectangular controls.</p>
  
  <p>What is the best way to create owner drawn controls in Qt with derived colors from style sheets?</p>