ok i made code like this.
i can draw an ellipse by clicking push button.
but when i click button it draws the last ellipse.
i want to draw them one on the top of the other.
how can i do this?
thank you very much.
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(Drawit()));
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(Drawit()));
To copy to clipboard, switch view to plain text mode
void MainWindow::Drawit()
{
drawEllipse=1;
positionx=positionx+1;
positiony=positiony+1;
update();
}
void MainWindow::Drawit()
{
drawEllipse=1;
positionx=positionx+1;
positiony=positiony+1;
update();
}
To copy to clipboard, switch view to plain text mode
{
if( drawEllipse )
{
painter.drawEllipse(positionx,positiony,100,100);
}
}
void MainWindow::paintEvent(QPaintEvent *pe)
{
if( drawEllipse )
{
QPainter painter( this );
painter.drawEllipse(positionx,positiony,100,100);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks