{
linepen.setCapStyle(Qt::RoundCap);
linepen.setWidth(30);
painter.
setRenderHint(QPainter::Antialiasing,
true);
painter.setPen(linepen);
if(y==1)
painter.drawPoint(point);
else
painter.drawLine(point,point2);
}
void mainwindow::paintEvent(QPaintEvent *e)
{
QPainter painter(this);
QPen linepen(Qt::red);
linepen.setCapStyle(Qt::RoundCap);
linepen.setWidth(30);
painter.setRenderHint(QPainter::Antialiasing,true);
painter.setPen(linepen);
if(y==1)
painter.drawPoint(point);
else
painter.drawLine(point,point2);
}
To copy to clipboard, switch view to plain text mode
I used this code. for painter(this) i tryed painter(ui->frame3).
( i have 3frames for equal size, i use..
ui->frame1->hide();ui->frame2->hide();ui->frame3->show();
ui->frame1->hide();ui->frame2->hide();ui->frame3->show();
To copy to clipboard, switch view to plain text mode
to show each frame using button click.
I have to draw only on the third frame. This code draws on the mainwindow ui window
Bookmarks