I want to highlight all the pixels where cursor moved after entering the widget and before leaving it.
On reimplementing the paintEvent and using drawPoint, I am able to display the current cursor position. But I dont want old points to disappear. How do i keep all previous points also highlighted???
I am not successful in using drawPath and drawPoints for this.

Qt Code:
  1. Lines::Lines(QWidget *parent) :
  2. QWidget(parent),
  3. ui(new Ui::Lines)
  4. {
  5. ui->setupUi(this);
  6. }
  7.  
  8.  
  9. void Lines::paintEvent(QPaintEvent *e)
  10. {
  11. QPainter qp(this);
  12. drawLines(&qp);
  13. }
  14.  
  15.  
  16. void Lines::drawLines(QPainter *qp)
  17. {
  18. QPen pen2(Qt::red, 8, Qt::SolidLine);
  19. qp->setPen(pen2);
  20.  
  21. int x;
  22. int y;
  23.  
  24. QPoint p = QCursor::pos();
  25. x = p.x();
  26. y= p.y();
  27.  
  28. qp->drawPoint(p);
  29. this->update();
  30. }
To copy to clipboard, switch view to plain text mode