|
|
|
|
@ -55,9 +55,11 @@ void nmObjBase::paintNodeHandle(QPainter* painter, const QPointF& pt,
|
|
|
|
|
painter->setPen(pen);
|
|
|
|
|
painter->setBrush(fillColor.isValid() ? QBrush(fillColor) : QBrush(Qt::NoBrush));
|
|
|
|
|
|
|
|
|
|
// 将一像素边线对齐到像素中心,并把边线本身计入节点框的总尺寸。
|
|
|
|
|
const qreal left = qRound(screenPos.x() - nPixelSize * 0.5) + 0.5;
|
|
|
|
|
const qreal top = qRound(screenPos.y() - nPixelSize * 0.5) + 0.5;
|
|
|
|
|
// 关闭抗锯齿时,Qt 已将 1 像素边线落到像素格内,只需对左上角取整。
|
|
|
|
|
// 不再额外加半像素,避免栅格化后节点框向右下偏离折线交点。
|
|
|
|
|
// 路径宽高扣除边线,使可见外框仍为 nPixelSize 像素。
|
|
|
|
|
const qreal left = qRound(screenPos.x() - nPixelSize * 0.5);
|
|
|
|
|
const qreal top = qRound(screenPos.y() - nPixelSize * 0.5);
|
|
|
|
|
painter->drawRect(QRectF(left, top, nPixelSize - 1, nPixelSize - 1));
|
|
|
|
|
painter->restore();
|
|
|
|
|
}
|
|
|
|
|
|