But idea is that i can see it in Widget as i draw them.. In Real i will need much more polygons, Like 1 million..
So simply create a method to update the data periodically and display it in paintEvent, pretty much something like you already have, but with "generate()" moved to AdvanceState. AdvanceState() should represent a single step in your calculations, used to update the data. Using a timer for this task seems reasonable.
If you want to limit the number of steps in your "simulation" use a member variable
Qt Code:
  1. #include "widget.h"
  2. #include "ui_widget.h"
  3. #include "polygonpoints.h"
  4.  
  5.  
  6. Widget::Widget(QWidget *parent) :
  7. QWidget(parent),
  8. ui(new Ui::Widget)
  9. {
  10. ui->setupUi(this);
  11. this->setAttribute(Qt::WA_NoSystemBackground,true);
  12.  
  13. this->stepsToDo = 10000;
  14. timer = new QTimer(this);
  15. connect(timer, SIGNAL(timeout()), this, SLOT(AdvanceState()));
  16. timer->start(1);
  17.  
  18. }
  19.  
  20. Widget::~Widget()
  21. {
  22. delete ui;
  23. }
  24. void Widget::AdvanceState(){
  25.  
  26. if(this->stepsToDo){
  27. // generate new polygon or do whatever is required for a single step
  28. --this->stepsToDo;
  29. update(); // update requests will be scheduled, this is not an immediate repaint
  30. } else{
  31. this->timer->stop();
  32. }
  33. }
  34.  
  35. void Widget::paintEvent(QPaintEvent *event)
  36. {
  37.  
  38. QPainter painter(this);
  39. painter.setRenderHint(QPainter::Antialiasing, true);
  40. // present the data generated in AdvanceStep()
  41. }
To copy to clipboard, switch view to plain text mode 
Btw. human eye can process around 10 separate images per second if I remember correctly, you can't even notice if you try to display millions of different polygons in a short time.