title: how to use a slot to update paint() in real time
body: <p>I try to create some legend for my application which will be updated in real time. I've tried to use a slot to do it but I've gotten <code>No such slot legend::paint()</code>. 
  Legend is updated only if I minimize and then maximize the window. Can anybody tell me how to properly use this slot to paint circles as representation of counter in legend?</p>
  
  <p>legend.cpp:</p>
  
  <pre><code>#include "legend.h"
  #include &lt;QGraphicsScene&gt;
  #include &lt;QPainter&gt;
  #include &lt;QDebug&gt;
  #include &lt;QGraphicsItem&gt;
  #include &lt;QTimer&gt;
  #include "player.h"
  
  legend::legend(Player* player)
  {
      this-&gt;player=player;
      timer = new QTimer(this);
      connect(timer, SIGNAL(timeout()), this, SLOT(paint()));
      timer-&gt;start(1);
  }
  
  QRectF legend::boundingRect() const
  {
      return QRectF(0,0,350,350);
  }
  
  QPainterPath legend::shape() const
  {
      QPainterPath path;
      path.addRect(0, 0, 350, 350);
      return path;
  }
  
  void legend::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
  {
      painter-&gt;setBrush(Qt::lightGray);
      painter-&gt;drawRect(0,0,350,350);
  
  
      painter-&gt;drawText(50,35,"COUNTER");
      for(int i = 0; i&lt;10; i++)
      {
          if(player-&gt;getCounter()&gt;i){
              painter-&gt;setBrush(Qt::yellow);
              painter-&gt;drawEllipse((i+1)*30,50,20,20);}
          else {
              painter-&gt;setBrush(Qt::lightGray);
              painter-&gt;drawEllipse((i+1)*30,50,20,20);
          }
      }
  }
  </code></pre>
  
  <p>legend.h:</p>
  
  <pre><code>#ifndef LEGEND_H
  #define LEGEND_H
  
  #include &lt;QGraphicsItem&gt;
  #include "player.h"
  
  class legend : public QGraphicsObject
  {
      Q_OBJECT
  
  public:
      legend(Player* player);
      QPainterPath shape() const;
      QRectF boundingRect() const;
      QTimer *timer;
  public slots:
      void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
  private:
      Player* player;
  };
  
  #endif // LEGEND_H
  </code></pre>