How to draw a rounded line shape using Qt?

How can I draw rounded line shape using QT. like this image.I need to design a rounded line when the button click.

void MainWindow::on_btnCreateRoundedLine_clicked()

enter image description here

Updated Image:

enter image description here

In this code which creates rectangle shape when the button click,likewise I need to create rounded line when the button click.And also which can able to rotate.

void Widget::on_btnCreateRect_clicked()
    QBrush blueBrush(Qt::green);
    QPen blackPen(Qt::black);
    rect = ui->graphicsView->scene()->addRect(-10,-10,250,100,blackPen);
    rect->setFlag(QGraphicsItem::ItemIsMovable, true);


If you want to graph curves, a recommended option is to use QGraphicsPathItem, to that object you have to pass a QPainterPath:

QPainterPath path;
path.moveTo(10, 20);
path.lineTo(10, 40);
path.arcTo(QRectF(10, 20, 40, 40), 180, 180);
path.moveTo(50, 40);
path.lineTo(50, 20);
QPen redPen(Qt::red);
QGraphicsPathItem* item = ui->graphicsView->scene()->addPath(path, redPen);
    QGraphicsPathItem* item = new QGraphicsPathItem(path);


enter image description here

You can find a complete example in the following link.