title: How to set border to widget, inherited from QFrame?
body: <p>I created widget of led light with radial gradient,(found example in internet). It was inheritated from qwidget and all type of borders that I could use in there are presented By QPaint. But I need more difficult shape for this LED, I saw this kind of borders in QFrame class, I inheritade my widget from it, but when I wanted to set type of border to my widget, nothing happened. May be some mistake in paintEvent method?</p>
  
  <p><em>ledindicator.cpp</em></p>
  
  <pre><code> #include "ledindicator.h"
   #include &lt;QPainter&gt;
  
    LedIndicator::LedIndicator(QWidget *parent) :
     QFrame(parent)
   {
    setFixedSize(218, 218);
    lit = false;
    ledOnColor=Qt::green;
    ledOffColor=Qt::red;
    ledOnPattern = Qt::SolidPattern;
    ledOffPattern = Qt::SolidPattern;
    ledSize=400;
  }
  
  void LedIndicator::paintEvent(QPaintEvent *) {
     QPainter p(this);
  
   //QPen pen(Qt::black, 3, Qt::SolidLine, Qt::FlatCap, Qt::RoundJoin);
   //p.setPen(pen);
  
    QRadialGradient radialGradient(ledSize, ledSize, ledSize , ledSize + 7, ledSize + 7);
    radialGradient.setColorAt(0.0, Qt::white);
    radialGradient.setColorAt(0.2, Qt::green);
    radialGradient.setColorAt(1.0, Qt::green);
  
    if (lit){
       p.setBrush(QBrush( radialGradient)); //
    } else {
      p.setBrush(QBrush( radialGradient)); //ledOffColor,
    }
  
    p.drawRect(0,0,ledSize,ledSize);
    QFrame::setFrameStyle( QFrame::Box | QFrame::Raised);//setFrameStyle(QFrame::Box|QFrame::Raised);
    QFrame::setLineWidth(0);
    QFrame::setMidLineWidth(3);
    //setLineWidth(0);
    //
    //setFrameShape( QFrame::Shape);
  }
  
  void LedIndicator::switchLedIndicator() {
    lit = ! lit;
    repaint();
  }
  void LedIndicator::setState(bool state)
  {
    lit = state;
    repaint();
  }
  void LedIndicator::toggle()
  {
    lit = ! lit;
    repaint();
  }
  
  void LedIndicator::setOnColor(QColor onColor)
  {
    ledOnColor=onColor;
    repaint();
  }
  void LedIndicator::setOffColor(QColor offColor)
  {
    ledOffColor=offColor;
    repaint();
  }
  void LedIndicator::setOnPattern(Qt::BrushStyle onPattern)
  {
    ledOnPattern=onPattern;
    repaint();
  }
  void LedIndicator::setOffPattern(Qt::BrushStyle offPattern)
  {
    ledOffPattern=offPattern;
    repaint();
  }
  void LedIndicator::setLedSize(int size)
  {
    ledSize=size;
    setFixedSize(size+10, size+10);
    repaint();
  }
  </code></pre>
  
  <p><em>ledindicator.h</em></p>
  
  <pre><code>#ifndef LEDINDICATOR_H
  #define LEDINDICATOR_H
  
  #include &lt;QWidget&gt;
  #include &lt;QRadialGradient&gt;
  #include &lt;QPen&gt;
  #include &lt;QLabel&gt;
  
  class LedIndicator: public QFrame {
      Q_OBJECT
    public:
      LedIndicator(QWidget *parent = 0);
      void setState(bool state);
      void toggle();
      void setOnColor(QColor onColor);
      void setOffColor(QColor offColor);
      void setOnPattern(Qt::BrushStyle onPattern);
      void setOffPattern(Qt::BrushStyle offPattern);
      void setLedSize(int size);
  
    public slots:
      void switchLedIndicator();
    protected:
      void paintEvent(QPaintEvent *);
    private:
      QPen pen;
      bool lit;
      QColor ledOnColor;
      QColor ledOffColor;
      Qt::BrushStyle ledOnPattern;
      Qt::BrushStyle ledOffPattern;
      int ledSize;
  };
  
  #endif // LEDINDICATOR_H
  </code></pre>