title: Why the application crashes when QPushButton::paintEvent is followed by QPainter::fillRect?
body: <p>I am implementing a round button by subclassing <code>QPushButton</code> and handling the <code>paintEvent</code>. I want to show the text set by the user and then draw a circle.</p>
  
  <p>The application crashes at <code>QPainter::fillRect</code> after calling the <code>QPushButton::paintEvent</code> method. If <code>QPushButton::paintEvent</code> is not called it does not crash, but the button text is not shown.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>class CRoundAnimatingBtn : public QPushButton
  {
      Q_OBJECT
  public:
      explicit CRoundAnimatingBtn(QWidget *parent = nullptr)  : QPushButton(parent) {}
  
  protected:
      void resizeEvent(QResizeEvent *) { setMask(QRegion(rect(), QRegion::Ellipse)); }
      void paintEvent(QPaintEvent * e) {
          QPainter painter(this);
          QPointF center(width()/2, height()/2);
          QRadialGradient radialGradient(center, qMin(width(), height())/2, center);
  
          QPushButton::paintEvent(e); // Application crashes if this is called
  
          if (isDown()) {
              radialGradient.setColorAt(0.0,Qt::transparent);
              radialGradient.setColorAt(0.79, Qt::transparent);
              radialGradient.setColorAt(0.80, Qt::gray);
              radialGradient.setColorAt(0.95, Qt::black);
              radialGradient.setColorAt(0.90, Qt::gray);
              radialGradient.setColorAt(0.91, Qt::transparent);
          } else {
              radialGradient.setColorAt(0.0,Qt::transparent);
              radialGradient.setColorAt(0.84, Qt::transparent);
              radialGradient.setColorAt(0.85, Qt::gray);
              radialGradient.setColorAt(0.90, Qt::black);
              radialGradient.setColorAt(0.95, Qt::gray);
              radialGradient.setColorAt(0.96, Qt::transparent);
          }
  
          painter.fillRect(rect(), radialGradient); // Application crashes here
      }
  };
  </code></pre>
  
  <p>How to fix the crash?</p>