title: QPainter and paintEvent : what is the use of QPaintEvent *event?
body: <p>I have a school project involving creating a  simple GUI and coloring graphs using a minimal number of colors. I am working with a classmate, and so far, we have laid out different ideas regarding how we will store the graphs in memory, and how to implement different coloration algorithms.  </p>
  
  <p>To create the GUI, we are using Qt, as I used it for another project before, it is free, and I generally find the documentation generally well detailed. Besides, I knew it had a drawing module, although I never used it.  </p>
  
  <p>After reading and the documentation and some examples, I was able to draw some basic shapes where I wished inside of a set area of a widget, and get them to correctly respond to resizing the widget.  </p>
  
  <p>To draw what I wish, I can write the paintEvent method this way, and just never use *event</p>
  
  <pre><code>void DrawArea::paintEvent(QPaintEvent *event)
  {
  //method body
  }
  </code></pre>
  
  <p>Or I can write it this way, and it works too</p>
  
  <pre><code>void DrawArea::paintEvent(QPaintEvent *)
  {
  //method body
  }
  </code></pre>
  
  <p>So, i have two questions :  </p>
  
  <ol>
  <li><p><strong>How does the widget knows when to call the paintEvent method ?</strong><br>
  If I'm not mistaken, every widget has a paint event, and I am
  overwriting it ? If it's wrong please correct me, maybe that is the
  reason why I don't really understand the way this pointer work.  </p></li>
  <li><p><strong>What is the QPaintEvent pointer ? (I mean, what does it represent ?)</strong></p></li>
  </ol>
  
  <p>Thanks for any insight you may give me</p>