title: How do I paint with QPainter?
body: <p>I have started learning Qt recently. <br>
  I did not get quite clear how can I paint using <code>QPainter</code> class. Let`s say I want just to place a few points in the window:</p>
  
  <pre><code>
  class PointDrawer: public QWidget {
      Q_OBJECT
  private:
      QPainter p;
  public:
      PointDrawer(QWidget* obj=0): QWidget(obj), p(this) {}
      virtual void paintEvent(QPaintEvent*) {
          p.setPen(QPen(Qt::black, 3));
          int n = 8;
          while(...) {
              qreal fAngle = 2 * 3.14 * i / n;
              qreal x = 50 + cos(fAngle) * 40;
              qreal y = 50 + sin(fAngle) * 40;
              p.drawPoint(QPointF(x, y));
                          i++;
          }
      }
  }
  
  int main(int argc, char *argv[]) {
      QApplication app(argc, argv);
      PointDrawer drawer;
  
      drawer.resize(200, 200);
      drawer.show();
  
      return app.exec();
  }
  </code></pre>
  
  <p>And after that, I got nothing!<br>Can you please tell me where I am wrong?</p>