Description
Add a layer system that lets users organize complex circuits into visual layers. Elements can be placed on different layers, and layers can be shown/hidden independently. Useful for separating data paths, control logic, and annotations.
Acceptance Criteria
Implementation Guide
1. Layer model
- Add a
Layer struct: { int id, QString name, bool visible, bool locked, int zOrder }
- Add
QList<Layer> m_layers to Scene
- Each
GraphicElement gets a m_layerId property
- Default layer (id=0) for backward compatibility
2. Visibility and locking
- In
Scene::drawBackground() and element paint, skip elements on hidden layers
- When a layer is locked, elements on it are not selectable or movable
- Use
QGraphicsItem::setFlag(ItemIsSelectable/ItemIsMovable) based on layer lock state
3. Layer panel UI
- Dockable widget listing all layers with visibility eye icon and lock icon
- Right-click: Rename, Delete, Merge layers
- Drag to reorder z-depth
- "Move selection to layer" context menu action
4. Serialization
- Store layer definitions in file metadata
- Store per-element layer assignment in the element's QMap
- Gate with
VersionInfo::hasLayers(version) — older versions load everything onto layer 0
Key files
App/Scene/Scene.h/.cpp — layer storage, visibility filtering
App/Element/GraphicElement.h/.cpp — layer assignment
App/Element/GraphicElementSerializer.cpp — serialize layer ID
App/UI/MainWindow.cpp — layer panel integration
- New files:
App/Scene/LayerManager.h/.cpp, App/UI/LayerPanel.h/.cpp
Description
Add a layer system that lets users organize complex circuits into visual layers. Elements can be placed on different layers, and layers can be shown/hidden independently. Useful for separating data paths, control logic, and annotations.
Acceptance Criteria
Implementation Guide
1. Layer model
Layerstruct:{ int id, QString name, bool visible, bool locked, int zOrder }QList<Layer> m_layerstoSceneGraphicElementgets am_layerIdproperty2. Visibility and locking
Scene::drawBackground()and element paint, skip elements on hidden layersQGraphicsItem::setFlag(ItemIsSelectable/ItemIsMovable)based on layer lock state3. Layer panel UI
4. Serialization
VersionInfo::hasLayers(version)— older versions load everything onto layer 0Key files
App/Scene/Scene.h/.cpp— layer storage, visibility filteringApp/Element/GraphicElement.h/.cpp— layer assignmentApp/Element/GraphicElementSerializer.cpp— serialize layer IDApp/UI/MainWindow.cpp— layer panel integrationApp/Scene/LayerManager.h/.cpp,App/UI/LayerPanel.h/.cpp