Fix bugtracker #108: the junction dot vanishes on a wide conductor

Conductor::paint() drew every junction as a fixed 3.0-unit ellipse,
regardless of how wide the conductor carrying it is. The conductor width is
user-settable from 0.4 to 20.0, so at anything above about 3.0 the dot is
narrower than the line it sits on and disappears entirely -- exactly when a
junction most needs to be legible.

The dot now scales with m_properties.cond_size, floored at the historic 3.0
so nothing changes at or below the default width of 1.0. Only the wide
conductors the report is about are affected.

cond_size is used rather than the pen width because the pen is inflated by 4
while the mouse is over the conductor; the junction should not grow on
hover.

Measured with a temporary trace over examples/741.qet: at the default width
the diameter stays 3.00, and with condsize="5" it becomes 15.00. Visually,
a PNG export of that widened project shows two junctions that were invisible
under the line rendering as clear dots. ctest 4/4, Qt 5.15.18.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-09-14 15:15:39 +12:00
parent 3cbb930751
commit 3665ec1bcd
+16 -1
View File
@@ -574,8 +574,23 @@ void Conductor::paint(QPainter *painter, const QStyleOptionGraphicsItem *options
painter -> setPen(final_conductor_pen);
painter -> setBrush(junction_brush);
painter -> setRenderHint(QPainter::Antialiasing, true);
// The junction dot has to read as a dot on top of the conductor
// that carries it, so it scales with the conductor width instead
// of being a fixed 3.0 across: on a wide conductor a 3.0 dot is
// narrower than the line and simply disappears (bugtracker #108).
//
// Floored at the historic 3.0 so nothing changes for the default
// width of 1.0 or anything thinner -- only the wide conductors
// the report is about are affected. m_properties.cond_size is
// used rather than the pen, whose width is inflated by 4 while
// the mouse is over the conductor.
const qreal junction_diameter = qMax(3.0, 3.0 * m_properties.cond_size);
const qreal junction_radius = junction_diameter / 2.0;
foreach(QPointF point, junctions_list) {
painter -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
painter -> drawEllipse(QRectF(point.x() - junction_radius,
point.y() - junction_radius,
junction_diameter,
junction_diameter));
}
}