Hi everyone,
i am working on a project where i need to draw lot of polygons. Is there any way to draw it without Timer? I am using QPainter... My problem is that i dont know how to draw a lot of polygons in short time, miliseconds.
Here is my code,
Code:
#include "widget.h" #include "ui_widget.h" #include "polygonpoints.h" ui(new Ui::Widget) { ui->setupUi(this); connect(timer, SIGNAL(timeout()), this, SLOT(AdvanceState())); timer->start(1); } Widget::~Widget() { delete ui; } void Widget::AdvanceState(){ this->setAttribute(Qt::WA_NoSystemBackground,true); if(brojac<300){ update(); std::cout << ++brojac << std::endl; } } { //std::cout << ++brojac << std::endl; int N=9; // broj vrhova x.set_x(N); x.generate(); //int N = 4; //broj vrhova for(int i = 0; i < N; ++i){ points[i].setX(x.vertices[i].get(0)); points[i].setY(x.vertices[i].get(1)); } painter.setPen(Qt::NoPen); painter.drawPolygon(points,N); delete[] points; }