GraphCanvas
The interaction chassis of a node-graph editor.
| Inherits | QWidget |
In the namespace widgets::graph. Declared in src/libs/libwidgets/graph/GraphCanvas.hpp.
Detailed description
construct-project-space P13, §PSU-6. This is the shared half of two editors that had been forked: libbahn's signal-flow tracker and libface's mass-spring rig. It owns the drag state machine, the pan, the zoom, the lasso, the menu plumbing and the selection — and it owns NO node model. Everything model-shaped goes through IGraphHost.
⚠ What it deliberately does NOT do. It does not unify the node model. libbahn's nodes are audio processors and libface's are mass points with a mass and an anchored flag; parity-matrix.md records why one type over both is the wrong target. The canvas holds opaque ids and asks the host.
Three defects from the donor copies are fixed here rather than carried in, because a defect in one library has one consumer and the same defect in libwidgets has every future one:
- The donor leaked its ShortcutHelper. It was a raw owning `new` and the class had no destructor at all. ⚠ Parenting is NOT the fix, because ShortcutHelper is not a QObject and has no parent to be given — which is exactly why the donor's `new … (nullptr)` looked plausible. Held in a QScopedPointer here, which is why ~GraphCanvas() is declared and defined out of line.
- The donor chain-dereferenced a nullable getter in two places. There is no such call here: a host answers with ids and NoId, so there is nothing to dereference.
- The donor dereferenced a value into a variable the next line marked Q_UNUSED. That call is simply gone.