参考资料:

https://www.cnblogs.com/Jace-Lee/p/5946342.html

效果图:

QPainter绘制特殊线条

 

代码:

void WgtText::paintEvent(QPaintEvent *event)
{

    QPainter painter(this);
    QPen pen;  // creates a default pen

    pen.setStyle(Qt::DashDotLine);
    pen.setWidth(3);
    pen.setBrush(Qt::blue);
    pen.setCapStyle(Qt::RoundCap);
    pen.setJoinStyle(Qt::RoundJoin);

    painter.setPen(pen);

    QPointF point_start(10,10);
    QPointF point_end(300, 400);

    painter.drawLine(point_start, point_end);

}

 

相关文章:

  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
猜你喜欢
  • 2022-02-15
  • 2021-07-14
  • 2022-12-23
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案