What is the purpose of this updateImage variable?

In general it should all be more or less like this:

Qt Code:
  1. void X::mousePressEvent(QMouseEvent *me) {
  2. m_pt = me->pos();
  3. }
  4.  
  5. void X::mouseReleaseEvent(QMouseEvent *me) {
  6. addLineToPixmap(m_pt, me->pos());
  7. m_pt = QPoint();
  8. }
  9.  
  10. void X::mouseMoveEvent(QMouseEvent *me) {
  11. addLineToPixmap(m_pt, me->pos());
  12. m_pt = me->pos();
  13. }
  14.  
  15. void X::addLineToPixmap(QPoint from, QPoint to) {
  16. QPainter p(&m_pixmap);
  17. p.drawLine(from, to);
  18. update();
  19. }
  20.  
  21. void X::paintEvent(...) {
  22. QPainter p(this);
  23. p.drawPixmap(m_pixmap);
  24. }
  25.  
  26. private:
  27. QPoint m_pt;
  28. QPixmap m_pixmap;
To copy to clipboard, switch view to plain text mode