title: QPaintEvent painting region in Qt?
body: <p>This is a basic doubt regarding the <code>Painting</code> done in Qt.
  I have a <code>QScrollArea</code> as my <code>centralWidget</code> in <code>Main Window</code> of my Application. I have added a <code>QFrame</code> <code>frame</code> to the <code>scrollarea</code>. The <code>Layout</code> of the <code>QFrame</code> is <code>QGridLayout</code>.
  When I add <code>widgets</code> to the <code>layout</code> like this:</p>
  
  <pre><code>MainWindow::AddLabel()
  {
      setUpdatesEnabled(false);
      QGridLayout *myGrid = (QGridLayout *)ui-&gt;frame-&gt;layout();
      for(int i = 0; i &lt; 1000; i++)
      {
          QLabel *label = new QLabel();
          QString str;
          str.SetNum(i);
          label-&gt;SetText(str);
          myGrid-&gt;AddWidget(label, 0, i, 0);//add label to i'th column of row 0
      }
      setUpdatesEnabled(true);
      repaint();
  }
  </code></pre>
  
  <p><em><strong>Please dont worry about the memory leak as it is not the focus of the question.</em></strong>
  So my doubt's are:</p>
  
  <ol>
  <li><p>Is setting the updates <code>disabled</code> during adding widgets to layout any helpful?</p></li>
  <li><p>Even if I maximise the window not all the QLabel's will be visible to me. So when the code flow leaves the above function &amp; goes to the event loop then are all the QLabel's &amp; the enormous area of QFrame painted? Or only those QLabel's which are visible &amp; only that much area of QFrame which is visible painted?</p></li>
  </ol>