@@ -27,8 +27,6 @@ void FluRectangle::paint(QPainter *painter) {
2727 QRectF rect = boundingRect ();
2828 bool drawBorder = borderValid ();
2929 if (drawBorder) {
30- // 绘制边框时画笔的宽度从路径向两侧扩充
31- // 因此实际绘制的矩形应向内侧收缩边框宽度的一半,避免边框裁剪导致不完整
3230 qreal halfBorderWidth = _borderWidth / 2.0 ;
3331 rect.adjust (halfBorderWidth, halfBorderWidth, -halfBorderWidth, -halfBorderWidth);
3432 }
@@ -40,7 +38,6 @@ void FluRectangle::paint(QPainter *painter) {
4038 r.append (0 );
4139 }
4240
43- // 从右下角开始逆时针绘制圆角矩形路径
4441 path.moveTo (rect.bottomRight () - QPointF (0 , r[2 ]));
4542 path.lineTo (rect.topRight () + QPointF (0 , r[1 ]));
4643 path.arcTo (QRectF (QPointF (rect.topRight () - QPointF (r[1 ] * 2 , 0 )), QSize (r[1 ] * 2 , r[1 ] * 2 )), 0 , 90 );
@@ -54,10 +51,8 @@ void FluRectangle::paint(QPainter *painter) {
5451 path.lineTo (rect.bottomRight () - QPointF (r[2 ], 0 ));
5552 path.arcTo (QRectF (QPointF (rect.bottomRight () - QPointF (r[2 ] * 2 , r[2 ] * 2 )), QSize (r[2 ] * 2 , r[2 ] * 2 )), 270 , 90 );
5653
57- // 填充背景
5854 painter->fillPath (path, _color);
5955
60- // 绘制边框
6156 if (drawBorder) {
6257 QPen pen (_borderColor, _borderWidth, _borderStyle);
6358 if (_borderStyle == Qt::DashLine || _borderStyle == Qt::CustomDashLine) {
0 commit comments