Repository navigation
Draw node shadows without a graphics effect, by default - #544
Merged
Merged
Conversation
This was referenced Nov 22, 2026
The Qt drop shadow effect together with the node pixmap cache crops a node that is larger than the view when the view is zoomed in. This is QTBUG-77400 and Qt has not fixed it. It was reported as #121 in 2017. The bug came back. b56a7d0 added ShadowEnabled and turned the shadow off by default, which avoided the cropping. 571499b turned it on again by default, so the cropping returned for all nodes. Doome161 proposed a shadow that needs no graphics effect in #534. This commit is based on that proposal. DefaultNodePainter draws the shadow from translucent rounded rectangles. The layers are fitted to QGraphicsDropShadowEffect with offset 4 and blur radius 20. The opacity matches within about 4 of 255 at 0 to 24 px from the node edge. NodeGraphicsObject creates no graphics effect in this mode. NodeStyle::PaintedShadowEnabled switches the mode. It is true in DefaultStyle.json. A style JSON without the key reads as false and keeps the graphics effect. Custom painters have no shadow in this mode and must draw their own, or set the key to false. The custom_painter example does that. The shadow reaches 11 px above and left, and 19 px below and right, so it fits the 20 px margins of the default geometries. Performance was not confirmed. On macOS (Apple M1, Qt 6.12) the repaint time is about the same as with the Qt effect, and higher with many overlapping nodes. The change is made for the crop fix, not for speed. The tests cover the default, the JSON round trip, the choice of mode, the footprint and the drawing. One test zooms in on a node larger than the view and checks that the node is drawn completely. It fails with the graphics effect. The docs and the FAQ describe the mode and the Qt bug. Fixes #121
paceholder
force-pushed
the
pr-534-clean
branch
from
November 22, 2026 20:03
2b95682 to
0ccc23a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Draw the node shadow in
DefaultNodePainterand make this the default.The Qt drop shadow effect together with the node pixmap cache crops a node that is larger than
the view when the view is zoomed in (QTBUG-77400, not fixed). The painted shadow uses no
graphics effect, so the node is drawn completely.
This continues #534 by Doome161. It is one commit with the author kept. On top of that PR it has:
QGraphicsDropShadowEffect(offset 4, blur 20). I rendered both and fittedthe layers; the opacity matches within about 4 of 255 at 0 to 24 px from the node edge.
PaintedShadowEnabledto true inDefaultStyle.json. A style JSON without the key stillkeeps the Qt graphics effect.
effect and passes with the painted shadow.
Limits: custom painters have no shadow in this mode and must draw their own. Custom geometries
need a margin of 11 px above and left, and 19 px below and right. Performance was not confirmed: on macOS (Apple M1, Qt 6.12) the repaint time is about the same
as with the Qt effect, and higher with many overlapping nodes. The change is made for the crop
fix. The docs say so.
Testing
Breaking changes?
Source compatible. The default look changes slightly (an approximation of the Qt shadow), and
custom painters lose the shadow unless they draw it.
NodeStylegets a new public member, soshared builds need a rebuild. This is meant for a minor release (3.2.0).
Related issue
Fixes #121
Supersedes #534