Linked Questions

Popular Questions

Qt4 How to draw inside a widget?

Asked by At

Qt4, QtCreator

I am trying to draw inside Widget:

void Widget::on_pushButton_clicked()
{
    QPainter painter;

    painter.begin(ui->label);

    QRectF rectangle(10.0, 20.0, 80.0, 60.0);
     int startAngle = 30 * 16;
     int spanAngle = 120 * 16;
     painter.drawArc(rectangle, startAngle, spanAngle);

    painter.end();
}

But when I press button nothing happens.

How to do this right way?

Related Questions