title: Qt Painter don't update
body: <p>I need to paint simple rect but when I call update() function it doesn't do anything. Here is my code:</p>
  
  <pre><code>...//this is called when button is pressed, when application loads nothing should be drawn.
  
      draw = true;
      update();
  }
  
  void MainWindow::paintEvent(QPaintEvent *e){
      QPainter painter(this);
      QLinearGradient lg(QPoint(20, 80), QPoint(215, 390));
      lg.setColorAt(0, Qt::white);
      lg.setColorAt(1, Qt::blue);
      QBrush brush(lg);
      painter.setPen(Qt::black);
      painter.setBrush(brush);
      if(draw == true){
      painter.drawRect(20, 80, 195, 300);
  }
  }
  </code></pre>